// Type definitions for child-process-promise 2.2 // Project: https://github.com/patrick-steele-idem/child-process-promise // Definitions by: Luis Paulo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 /// import { ChildProcess, ExecFileOptionsWithBufferEncoding, ExecFileOptionsWithOtherEncoding, ExecFileOptionsWithStringEncoding, ExecOptions, ForkOptions, SpawnOptions } from 'child_process'; /** * Simple wrapper around the child_process module that makes use of promises */ export interface PromiseResult { childProcess: ChildProcess; stdout: Enc; stderr: Enc; } export interface SpawnPromiseResult extends PromiseResult { code: number; } export interface ChildProcessPromise extends Promise { childProcess: ChildProcess; } export interface Options { /** * Pass an additional capture option to buffer the result of stdout and/or stderr * Default: [] */ capture?: []|['stdout'|'stderr']|['stdout', 'stderr']|['stderr', 'stdout'] | undefined; /** * Array of the numbers that should be interpreted as successful execution codes * Default: [0] */ successfulExitCodes?: number[] | undefined; } export function exec( command: Readonly, options: Readonly ): ChildProcessPromise>; export function exec( command: Readonly, options: Readonly ): ChildProcessPromise>; export function exec( command: Readonly, options: Readonly ): ChildProcessPromise>; export function exec( command: Readonly, options?: Readonly ): ChildProcessPromise>; export function execFile( file: Readonly, options: Readonly ): ChildProcessPromise>; export function execFile( file: Readonly, args: ReadonlyArray | null, options: Readonly ): ChildProcessPromise>; export function execFile( file: Readonly, options: Readonly ): ChildProcessPromise>; export function execFile( file: Readonly, options: Readonly ): ChildProcessPromise>; export function execFile( file: Readonly, args: ReadonlyArray | null, options: Readonly ): ChildProcessPromise>; export function execFile( file: Readonly, args?: ReadonlyArray | null, options?: Readonly ): ChildProcessPromise>; export function spawn( command: Readonly, args?: ReadonlyArray | null, options?: Readonly ): ChildProcessPromise; export function fork( modulePath: string, args?: ReadonlyArray, options?: Readonly ): ChildProcessPromise;