1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import child_process from "child_process";
import { debug } from "./console";
export function spawn(
cmd: string,
args: string[],
options: child_process.SpawnOptions = {},
): {
exitCode: number;
stdout: string;
stderr: string;
} {
debug("spawn", [cmd, ...args].join(" "));
const { status, stdout, stderr } = child_process.spawnSync(cmd, args, {
stdio: "pipe",
encoding: "utf-8",
...options,
});
return {
exitCode: status ?? 1,
stdout,
stderr,
};
}
|