@beenotung/tslib
Version:
utils library in Typescript
32 lines (31 loc) • 917 B
TypeScript
import { exec as _exec, SpawnOptionsWithoutStdio } from 'child_process';
export declare const exec: typeof _exec.__promisify__;
export declare class SpawnError extends Error {
stdout: string;
stderr: string;
processError?: any;
code?: number;
constructor(stdout: string, stderr: string);
}
export declare function spawn(options: {
cmd: string;
args?: string[];
options?: SpawnOptionsWithoutStdio;
on_stdout?: (chunk: any) => void;
on_stderr?: (chunk: any) => void;
on_error?: (error: any) => void;
}): Promise<number | null>;
/**
* spawn a child process and return the stdout and stderr in promise
*
* the console is not used to output the stdout and stderr
*/
export declare function spawnAndWait(options: {
cmd: string;
args: string[];
options?: SpawnOptionsWithoutStdio;
}): Promise<{
code: number | null;
stdout: string;
stderr: string;
}>;