1 | import _ from 'lodash';
|
2 | import { exec } from 'child_process';
|
3 |
|
4 | export 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 |