///
import { ChildProcess, SpawnOptions } from "child_process";
export interface WritableLog {
/**
* Some implementations expose their log as a string.
* Others may not, as it could be too long etc.
*/
log?: string;
write(what: string): void;
}
/**
* Type that can react to the exit of a spawned child process, after
* Node has terminated without reporting an error.
* This is necessary only for commands that can return
* a non-zero exit code on success.
* @return whether this result should be considered an error.
*/
export declare type ErrorFinder = (code: number, signal: string, log: WritableLog) => boolean;
/**
* Default ErrorFinder that regards return code 0 as success
* @param {number} code
* @return {boolean}
* @constructor
*/
export declare const SuccessIsReturn0ErrorFinder: ErrorFinder;
export interface ChildProcessResult {
error: boolean;
code: number;
message?: string;
childProcess: ChildProcess;
}
export interface SpawnWatchOptions {
errorFinder: ErrorFinder;
stripAnsi: boolean;
timeout: number;
logCommand: boolean;
}
/**
* Spawn a process and watch
* @param {SpawnCommand} spawnCommand
* @param options options
* @param {ProgressLog} log
* @param {Partial} spOpts
* @return {Promise}
*/
export declare function spawnAndWatch(spawnCommand: SpawnCommand, options: SpawnOptions, log: WritableLog, spOpts?: Partial): Promise;
/**
* The first two arguments to Node spawn
*/
export interface SpawnCommand {
command: string;
args?: string[];
options?: any;
}
/**
* toString for a SpawnCommand. Used for logging.
* @param {SpawnCommand} sc
* @return {string}
*/
export declare function stringifySpawnCommand(sc: SpawnCommand): string;
/**
* Convenient function to create a spawn command from a sentence such as "npm run compile"
* Does not respect quoted arguments
* @param {string} sentence
* @param options
* @return {SpawnCommand}
*/
export declare function asSpawnCommand(sentence: string, options?: SpawnOptions): SpawnCommand;
/**
* Kill the child process and wait for it to shut down. This can take a while as child processes
* may have shut down hooks.
* @param {module:child_process.ChildProcess} childProcess
* @return {Promise}
*/
export declare function poisonAndWait(childProcess: ChildProcess): Promise;
//# sourceMappingURL=spawned.d.ts.map