spawn_capture.ts

view source

Declarations
#

2 declarations

spawn_capture
#

spawn_capture.ts view source

(program: SpawnProgram, args: readonly string[], options?: SpawnCallOptions | undefined): Promise<SpawnCaptured> import {spawn_capture} from '@fuzdev/fuz_repos/spawn_capture.js';

Runs program, capturing its stdout and stderr with stdin inherited. The inherited stream keeps the child in the terminal's session, so unlike SpawnProgram.out, /dev/tty still reaches ssh, a credential helper, or a pinentry. A process the program leaves running that still holds a pipe is cut off after a bounded wait, unreported, so its later output is lost.

program

type SpawnProgram

args

the arguments after argv[0]

type readonly string[]

options?

type SpawnCallOptions
optional

returns

Promise<SpawnCaptured>

throws

  • `SpawnError` - if the program can't start

SpawnCaptured
#

spawn_capture.ts view source

SpawnCaptured

type ({ readonly kind: "exited"; readonly code: number; } & { stdout: string; stderr: string; }) | ({ readonly kind: "signaled"; readonly signal: string; } & { stdout: string; stderr: string; }) | ({ readonly kind: "timed_out" | "aborted"; readonly code: number | null; readonly signal: string | null; } & { stdout: string; stderr: string; })

import type {SpawnCaptured} from '@fuzdev/fuz_repos/spawn_capture.js';

How a program ended and its output as UTF-8 text.

Imported by
#