/** * @brief Interface for exec and spawn options. */ export interface ExecOptions { /** * @brief The callback to trace the stdout. Default null. */ logStdout?: ((data: string) => void) | null; /** * @brief The callback to trace the stderr. Default null. */ logStderr?: ((data: string) => void) | null; /** * @brief The callback to trace the return code. Only considered for spawn. * Default null. */ logCode?: ((data: number) => void) | null; /** * @brief Whether to consider a non-zero return code as an error. * Only considered for spawn. Default true. */ checkCode?: boolean; /** * @brief Whether to prepend the stderr to the possible error object * message. Only considered if logStderr is null and for exec. * Default false. */ prependStderr?: boolean; /** * @brief Whether to prepend the stderr to the possible error object * message. Only considered if logStdout is null and for exec. * Default false. */ prependStdout?: boolean; } /** * @brief Return a promise method to execute a command. * Internally call childProcess.exec(). * @param {ExecOptions} options The exec options. * @return {(cmd: Array) => Promise} The callback * accepting the command and returning the child process handle. */ declare function exec(options?: ExecOptions): (cmd: Array) => Promise; /** * @brief Return a promise method to execute a command. * Internally call childProcess.spawn(). * @param {ExecOptions} options The exec options. * @return {(cmd: string) => Promise} The callback * accepting the command and returning the child process handle. */ declare function spawn(options?: ExecOptions): (cmd: Array) => Promise; /** * @brief Wraps exec or spawn to collect their stdout as a string. * @param {(options: ExecOptions) => ((cmd: Array) => Promise)}foo * the function to wrap. * @param {ExecOptions} options The options. */ declare function collectStdout(foo: (opts: ExecOptions) => ((cmd: Array) => Promise), options?: ExecOptions): (cmd: Array) => Promise; export { collectStdout, exec, spawn };