// Define BufferEncoding type for TypeScript compatibility.
type BufferEncoding = globalThis.BufferEncoding;
// Type for promise-spawn options.
export type PromiseSpawnOptions = {
    cwd?: string | undefined;
    stdioString?: boolean | undefined;
    stdio?: StdioType | undefined;
    env?: NodeJS.ProcessEnv | undefined;
    shell?: boolean | string | undefined;
    signal?: AbortSignal | undefined;
    timeout?: number | undefined;
    uid?: number | undefined;
    gid?: number | undefined;
};
// Type for promise-spawn result.
export type PromiseSpawnResult = Promise<{
    cmd: string;
    args: string[] | readonly string[];
    code: number;
    signal: NodeJS.Signals | null;
    stdout: string | Buffer;
    stderr: string | Buffer;
}> & {
    process: ChildProcessType;
    stdin: WritableStreamType | null;
};
/**
 * Check if a value is a spawn error.
 */
export type SpawnError = {
    args: string[];
    cmd: string;
    code: number;
    name: string;
    message: string;
    signal: NodeJS.Signals | null;
    stack: string;
    stderr: string | Buffer;
    stdout: string | Buffer;
};
export type SpawnErrorWithOutputString = SpawnError & {
    stdout: string;
    stderr: string;
};
export type SpawnErrorWithOutputBuffer = SpawnError & {
    stdout: Buffer;
    stderr: Buffer;
};
export type SpawnExtra = Record<any, any>;
export type IOType = 'pipe' | 'ignore' | 'inherit' | 'overlapped';
export type StdioType = IOType | 'ipc' | Array<IOType | 'ipc'>;
export interface SpawnSyncReturns<T> {
    pid: number;
    output: Array<T | null>;
    stdout: T;
    stderr: T;
    status: number | null;
    signal: NodeJS.Signals | null;
    error?: Error | undefined;
}
/**
 * Check if a value is a spawn error with expected properties.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function isSpawnError(value: unknown): value is SpawnError;
/**
 * Check if stdio configuration matches a specific type.
 */
/*@__NO_SIDE_EFFECTS__*/
export declare function isStdioType(stdio: string | string[], type?: StdioType | undefined): boolean;
/*@__NO_SIDE_EFFECTS__*/
// Duplicated from Node.js child_process.SpawnOptions
// These are the options passed to child_process.spawn()
interface NodeSpawnOptions {
    cwd?: string | URL | undefined;
    env?: NodeJS.ProcessEnv | undefined;
    argv0?: string | undefined;
    stdio?: any;
    detached?: boolean | undefined;
    uid?: number | undefined;
    gid?: number | undefined;
    serialization?: 'json' | 'advanced' | undefined;
    shell?: boolean | string | undefined;
    windowsVerbatimArguments?: boolean | undefined;
    windowsHide?: boolean | undefined;
    signal?: AbortSignal | undefined;
    timeout?: number | undefined;
    killSignal?: NodeJS.Signals | number | undefined;
}
// Duplicated from Node.js child_process.ChildProcess
// This represents a spawned child process
interface ChildProcessType {
    stdin: NodeJS.WritableStream | null;
    stdout: NodeJS.ReadableStream | null;
    stderr: NodeJS.ReadableStream | null;
    readonly channel?: any;
    readonly stdio: [
        NodeJS.WritableStream | null,
        NodeJS.ReadableStream | null,
        NodeJS.ReadableStream | null,
        NodeJS.ReadableStream | NodeJS.WritableStream | null | undefined,
        NodeJS.ReadableStream | NodeJS.WritableStream | null | undefined
    ];
    readonly killed: boolean;
    readonly pid?: number | undefined;
    readonly connected: boolean;
    readonly exitCode: number | null;
    readonly signalCode: NodeJS.Signals | null;
    readonly spawnargs: string[];
    readonly spawnfile: string;
    kill(signal?: NodeJS.Signals | number): boolean;
    send(message: any, callback?: (error: Error | null) => void): boolean;
    send(message: any, sendHandle?: any | undefined, callback?: (error: Error | null) => void): boolean;
    send(message: any, sendHandle?: any | undefined, options?: any | undefined, callback?: (error: Error | null) => void): boolean;
    disconnect(): void;
    unref(): void;
    ref(): void;
}
// Duplicated from Node.js stream.Writable
interface WritableStreamType {
    writable: boolean;
    writableEnded: boolean;
    writableFinished: boolean;
    writableHighWaterMark: number;
    writableLength: number;
    writableObjectMode: boolean;
    writableCorked: number;
    destroyed: boolean;
    write(chunk: any, encoding?: BufferEncoding | undefined, callback?: (error?: Error | null) => void): boolean;
    write(chunk: any, callback?: (error?: Error | null) => void): boolean;
    end(cb?: () => void): this;
    end(chunk: any, cb?: () => void): this;
    end(chunk: any, encoding?: BufferEncoding | undefined, cb?: () => void): this;
    cork(): void;
    uncork(): void;
    destroy(error?: Error | undefined): this;
}
/**
 * Spawn a child process with enhanced error handling and output capture.
 */
export type SpawnOptions = import('./objects').Remap<NodeSpawnOptions & {
    spinner?: import('./spinner').Spinner | undefined;
    stdioString?: boolean;
    stripAnsi?: boolean;
}>;
export type SpawnResult = PromiseSpawnResult;
export type SpawnStdioResult = {
    cmd: string;
    args: string[] | readonly string[];
    code: number;
    signal: NodeJS.Signals | null;
    stdout: string | Buffer;
    stderr: string | Buffer;
};
/**
 * Spawn a child process and return a promise that resolves when it completes.
 */
export declare function spawn(cmd: string, args?: string[] | readonly string[], options?: SpawnOptions | undefined, extra?: SpawnExtra | undefined): SpawnResult;
/*@__NO_SIDE_EFFECTS__*/
/**
 * Synchronously spawn a child process.
 */
export type SpawnSyncOptions = Omit<SpawnOptions, 'spinner'>;
export declare function spawnSync(cmd: string, args?: string[] | readonly string[], options?: SpawnSyncOptions | undefined): SpawnSyncReturns<string | Buffer>;
export {};
