import 'reflect-metadata'; /** * Async api for executing child processes * (proper handling of stdout / stderr and options) */ export declare namespace UtilsExecProc { interface ExecProcOptions { cwd?: string; shell?: boolean | string; /** * default true * true -> good for long outputs * false -> good for short outputs (speed things up) */ biggerBuffer?: boolean; /** * default true */ showOutputColor?: boolean; /** * default true */ showOutput?: boolean | 'stdoutOnly' | 'stderrOnly'; /** * default process.env */ env?: { [key: string]: string; }; } interface ExecProcWaitUntilDoneOrThrow { shell?: boolean | string; /** * default [0] */ successCode?: number[]; /** * in stdout or stderr */ successOutputMessage?: string | string[] | { stdout?: string | string[]; stderr?: string | string[]; }; /** * in stdout or stderr */ failOutputMessage?: string | string[] | { stdout?: string | string[]; stderr?: string | string[]; }; } /** * This class expose function that are usually needed when working * with child processes (without digging into low level child_process module) */ class ExecProcResult { protected readonly command: string; protected readonly args: string[]; protected readonly execProcOptions: ExecProcOptions; private stdoutFromCommand; private stderrFromCommand; private child; private get maxBuffer(); private get env(); constructor(command: string, args: string[], execProcOptions?: ExecProcOptions); getOutput(options?: { shell?: boolean | string; }): Promise<{ stdout: string; stderr: string; }>; getStdoutWithoutShowingOrThrow(options?: { shell?: boolean | string; }): Promise; waitUntilDoneOrThrow(options?: ExecProcWaitUntilDoneOrThrow): Promise; } /** * @TODO @IN_PROGRESS */ export const spawnAsync: (command: string, options?: ExecProcOptions) => ExecProcResult; /** * @TODO @IN_PROGRESS */ export const spawnAdminSudo: (command: string, options?: ExecProcOptions) => Promise; /** * @TODO @IN_PROGRESS */ export const executeUntilEndOrThrow: ({ command, cwd, shell, }: { command: string; cwd: string; shell?: boolean; }) => Promise; export const getStdoutWithoutShowingOrThrow: ({ command, cwd, shell, }: { command: string; cwd: string; shell?: boolean; }) => Promise; export {}; }