/// /// /// /// /// import * as events from 'events'; import * as stream from 'stream'; import { ChildProcessWithoutNullStreams, SpawnOptionsWithoutStdio } from 'child_process'; export declare class CommandInvoker extends events.EventEmitter { constructor(command: string, args?: string[], options?: CommandOptions); setSpawn(spawn: (command: string, args?: ReadonlyArray, options?: SpawnOptionsWithoutStdio) => ChildProcessWithoutNullStreams): void; private readonly command; private readonly args; private readonly options; private spawn; private stdoutBuffer; private stderrBuffer; private detectedEncoding; private isEncodingDetected; private aggregateData; private bufferToString; private stringToBuffer; callCommand(): Promise; private flushBuffer; private bufferToLines; private getCommandString; } export declare class CommandOptions { outStream?: stream.Writable; errStream?: stream.Writable; listener?: CommandListener; cwd?: string; } export interface CommandResult { exitCode: number; stdoutContent: string; stderrContent: string; } export interface CommandListener { stdout?: DataHandlerFunc; stderr?: DataHandlerFunc; stdoutLine?: LineHandlerFunc; stderrLine?: LineHandlerFunc; } export type DataHandlerFunc = (data: Buffer) => void; export type LineHandlerFunc = (line: string) => void; export type OnLineFunc = (line: string) => void;