cli: remove sync version

This commit is contained in:
2024-06-23 19:55:08 +08:00
parent 7d9418c153
commit 505c5ef752

View File

@@ -1,21 +1,4 @@
import { ChildProcess, SpawnSyncOptionsWithBufferEncoding, SpawnSyncReturns, spawnSync as rawSpawnSync } from "child_process"; import { ChildProcess } from "child_process";
export function check(result: SpawnSyncReturns<Buffer | string>) {
if (result.error)
throw result.error;
if (result.status !== 0) {
throw result.stderr;
}
return result;
}
export function checkedSpawnSync(
command: string,
args: readonly string[],
options: SpawnSyncOptionsWithBufferEncoding,
): SpawnSyncReturns<Buffer | string> {
return check(rawSpawnSync(command, args, options));
}
export function promisifySpawn<T extends ChildProcess>(p: T) { export function promisifySpawn<T extends ChildProcess>(p: T) {
return new Promise<T>((resolve, reject) => { return new Promise<T>((resolve, reject) => {