UNPKG

351 BPlain TextView Raw
1import _ from 'lodash';
2import { exec } from 'child_process';
3
4export default function cmd(command: string): Promise<string> {
5 return new Promise<string>((resolve, reject) => {
6 exec(command, (err, stdout) => {
7 if (err !== null) {
8 reject(err);
9 } else {
10 resolve(_.split(stdout, '\n').join(''));
11 }
12 });
13 });
14}
15
\No newline at end of file