blob: c14a9edc33f43de212ec15f45fc4d8991461c441 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import {
type SpawnSyncOptions,
type SpawnSyncReturns,
spawnSync,
} from 'node:child_process';
const maxBuffer = 20 * 1024 * 1024;
/**
* Execute a command
* @param {string} cmd
* @param {string[]} args
*/
export function exec(
cmd: string,
args: string[] = [],
opts: SpawnSyncOptions = {},
): SpawnSyncReturns<string> {
// args from shelljs
return spawnSync(cmd, args, { ...opts, maxBuffer, encoding: 'utf8' });
}
|