Skip to content

SpawnHandle

Defined in: src/core/adapters.ts:82

Handle to a spawned process

Allows streaming output and waiting for completion. Implements AsyncDisposable for use with await using.

Example

// Traditional usage
const handle = adapter.spawnStreaming({ argv: ['git', 'fetch'] });
try {
for await (const line of handle.stdout) { console.log(line); }
} finally {
handle.kill();
}
// With await using (recommended)
await using handle = adapter.spawnStreaming({ argv: ['git', 'fetch'] });
for await (const line of handle.stdout) { console.log(line); }
// Automatically disposed when scope exits

Extends

  • AsyncDisposable

Properties

stderr

readonly stderr: AsyncIterable<string>

Defined in: src/core/adapters.ts:86

Async iterator for stderr lines


stdout

readonly stdout: AsyncIterable<string>

Defined in: src/core/adapters.ts:84

Async iterator for stdout lines

Methods

[asyncDispose]()

Call Signature

[asyncDispose](): PromiseLike<void>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.disposable.d.ts:40

Returns

PromiseLike<void>

Inherited from

AsyncDisposable.[asyncDispose]

Call Signature

[asyncDispose](): PromiseLike<void>

Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/compatibility/disposable.d.ts:13

Returns

PromiseLike<void>

Inherited from

AsyncDisposable.[asyncDispose]


kill()

kill(signal?): void

Defined in: src/core/adapters.ts:90

Kill the process

Parameters

signal?

"SIGTERM" | "SIGKILL"

Returns

void


wait()

wait(): Promise<SpawnResult>

Defined in: src/core/adapters.ts:88

Wait for process completion

Returns

Promise<SpawnResult>