1 |
|
2 |
|
3 | import {promisify} from 'node:util';
|
4 | import childProcess from 'node:child_process';
|
5 |
|
6 | const execFile = promisify(childProcess.execFile);
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | export async function exec(command, arguments_) {
|
15 | const subprocess = await execFile(command, arguments_, {encoding: 'utf8'});
|
16 | subprocess.stdout = subprocess.stdout.trim();
|
17 | return subprocess;
|
18 | }
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | export function execSync(command, arguments_) {
|
27 | return childProcess.execFileSync(command, arguments_, {
|
28 | encoding: 'utf8',
|
29 | stdio: ['ignore', 'pipe', 'ignore'],
|
30 | }).trim();
|
31 | }
|