import type { ChildProcess, ChildProcessByStdio, ChildProcessWithoutNullStreams, ProcessEnvOptions, SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe, } from "node:child_process"; import type { Readable, Writable } from "node:stream"; import type { Path } from "path-class"; import type { TrailingNewlineOptions } from "./trimTrailingNewlines"; export type NodeCwd = ProcessEnvOptions["cwd"] | Path; export type NodeWithCwd = Omit< T, "cwd" > & { cwd?: NodeCwd }; export interface WithExitPromises { success: Promise; exited: Promise; // This can't be called `exitCode`, because that's already taken by the lazily populated property. exitCodePromise: Promise; } export interface WithResponse { response: () => Response; text: (options?: TrailingNewlineOptions) => Promise; text0: () => AsyncGenerator; json: () => Promise; } export interface WithStdoutResponse { stdout: Readable & WithResponse; } export interface WithStderrResponse { stderr: Readable & WithResponse; } export declare function spawnType( options?: NodeWithCwd, ): ChildProcessWithoutNullStreams & WithExitPromises; export declare function spawnType( options: NodeWithCwd< SpawnOptionsWithStdioTuple >, ): ChildProcessByStdio & WithExitPromises & WithStdoutResponse & WithStderrResponse; export declare function spawnType( options: NodeWithCwd< SpawnOptionsWithStdioTuple >, ): ChildProcessByStdio & WithExitPromises & WithStdoutResponse; export declare function spawnType( options: NodeWithCwd< SpawnOptionsWithStdioTuple >, ): ChildProcessByStdio & WithExitPromises & WithStderrResponse; export declare function spawnType( options: NodeWithCwd< SpawnOptionsWithStdioTuple >, ): ChildProcessByStdio & WithExitPromises & WithStdoutResponse & WithStderrResponse; export declare function spawnType( options: NodeWithCwd< SpawnOptionsWithStdioTuple >, ): ChildProcessByStdio & WithExitPromises; export declare function spawnType( options: NodeWithCwd< SpawnOptionsWithStdioTuple >, ): ChildProcessByStdio & WithExitPromises & WithStdoutResponse; export declare function spawnType( options: NodeWithCwd< SpawnOptionsWithStdioTuple >, ): ChildProcessByStdio & WithExitPromises & WithStderrResponse; export declare function spawnType( options: NodeWithCwd< SpawnOptionsWithStdioTuple >, ): ChildProcessByStdio & WithExitPromises; export declare function spawnType( options: NodeWithCwd, ): ChildProcess & WithExitPromises;