UNPKG

turbo-gulp

Version:

Gulp tasks to boost high-quality projects.

85 lines (84 loc) 2.29 kB
/// <reference types="node" /> import { ChildProcess } from "child_process"; import { Incident } from "incident"; export interface ExecFileOptions { cwd?: string; env?: { [key: string]: string; }; timeout?: number; maxBuffer?: number; killSignal?: string; uid?: number; gid?: number; } export interface ExecFileResult { stdout: Buffer; stderr: Buffer; } export interface ExecFileErrorData { /** * Executed command */ cmd: string; killed: boolean; /** * Exit code: 0 if the execution was successful, else there was a runtime error */ code: number; signal: null | any; stdout: Buffer; stderr: Buffer; } export declare class ExecFileError extends Incident<ExecFileErrorData, "ExecFileError", Error> { constructor(nativeError: Error, stdout: Buffer | string, stderr: Buffer | string); } export declare function readText(file: string): Promise<string>; export declare function writeText(file: string, text: string): Promise<void>; export declare function execFile(file: string, args: string[], options?: ExecFileOptions): Promise<ExecFileResult>; export interface SpawnOptions { cwd?: string; env?: { [key: string]: string; }; stdio?: "inherit" | "pipe"; /** * Run in detached mode. Default: `false`. */ detached?: boolean; } export interface SpawnResult { /** * Buffer containing the whole standard output of the spawned process. */ stdout: Buffer; /** * Buffer containing the whole standard error of the spawned process. */ stderr: Buffer; /** * Exit value of the spawned process: a return code or exit signal. */ exit: Exit; } /** * Exit value of a spawned process: a return code or exit signal */ export declare type Exit = SignalExit | CodeExit; export interface CodeExit { type: "code"; code: number; } export interface SignalExit { type: "signal"; signal: string; } export declare class SpawnedProcess { readonly process: ChildProcess; private readonly stdoutChunks; private readonly stderrChunks; private exit?; constructor(file: string, args: string[], options: SpawnOptions); toPromise(): Promise<SpawnResult>; private getBuffers(); }