UNPKG

topkat-utils

Version:

A comprehensive collection of TypeScript/JavaScript utility functions for common programming tasks. Includes validation, object manipulation, date handling, string formatting, and more. Zero dependencies, fully typed, and optimized for performance.

25 lines (24 loc) 1.4 kB
import { ChildProcess } from 'child_process'; /** Execute a custom command into a child terminal and wait for process completion */ export declare function execWaitForOutput(command: string, config?: Partial<{ /** Whenever to log output to the console, choose false to execute the process silently. Default: true */ logOutputStream: boolean; /** when the output contain this string or matches this regexp, process is considered done. Else it will wait for exit */ stringOrRegexpToSearchForConsideringDone: string; /** timeout before killing process in seconds. Put -1 or 0 de disable. Default: 20 */ nbSecondsBeforeKillingProcess: number; /** { a: 1000, b: 2000 } { keyCode: sendAfterXms }; Eg: the key "keyCode" will be sent to terminal after "sendAfterXms" milliseconds */ keyCodeToSend: { [keyCode: string]: number; }; /** log: log the error as an error | throw: throw the error. Default: "throw" */ errorHandle: 'log' | 'error'; /** this callback will be called every time the terminal outputs something with the first param being the outputted string */ streamConsoleOutput: (outputStr: string) => any; /** see nodeJs exec() command options */ execOptions: { [seeNodeJsDocOnExec: string]: any; cwd?: string | undefined; }; onStartProcess(process: ChildProcess): any; }>): Promise<string | undefined>;