@sinclair/hammer
Version:
Build Tool for Browser and Node Applications
56 lines (55 loc) • 1.72 kB
TypeScript
export interface IShell {
wait(): Promise<number | null>;
dispose(): void;
}
export declare class WindowsShell implements IShell {
private readonly command;
private readonly cp;
private promise;
private resolve;
private disposed;
private exited;
constructor(command: string, stdio: 'inherit' | 'ignore');
wait(): Promise<number | null>;
dispose(): void;
private onExit;
private onClose;
private terminate;
private parseArguments;
private consumeChars;
private consumeCharsAsString;
}
export declare class LinuxShell implements IShell {
private readonly command;
private readonly cp;
private promise;
private resolve;
private disposed;
private exited;
constructor(command: string, stdio: 'inherit' | 'ignore');
wait(): Promise<number | null>;
dispose(): void;
private onExit;
private onClose;
private terminate;
private parseArguments;
}
export declare class Shell implements IShell {
private readonly shell;
constructor(command: string, stdio: 'inherit' | 'ignore');
wait(): Promise<number | null>;
dispose(): void;
}
export interface ShellOptions {
/** Expected Exit Code */
expect?: number;
/** Suppress stdio */
stdio?: boolean;
}
/**
* Executes the given shell command and returns its exitcode. This function will inherit the
* stdio interfaces of the the host process. This function will throw if the processes exitcode
* does not equal the expected value. If left undefined, this function will resolve successfully
* irrespective of if the process crashed.
*/
export declare function shell(command: string, options?: ShellOptions): Promise<number | null>;