fromSpawn()
Stream stdout, stderr, and exit events from a Node child process.
Import
Section titled “Import”import { fromSpawn } from "@graphrefly/ts/sources/node";Signature
Section titled “Signature”function fromSpawn( cmd: string, args: readonly string[] = [], opts: FromSpawnOptions = {},): Operator<never, SpawnEvent>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
cmd | string | Executable name or absolute path passed to child_process.spawn. |
args | readonly string[] | Arguments passed to the child process. |
opts | FromSpawnOptions | Optional cwd, env, stdio, shell, cancellation, and kill-grace controls. |
Returns
Section titled “Returns”A node-only source operator that emits SpawnEvent DATA values and terminal ERROR/COMPLETE events.
Example
Section titled “Example”import { graph } from "@graphrefly/ts/graph";import { fromSpawn } from "@graphrefly/ts/sources/node";
const g = graph();const ls = g.initNode(fromSpawn("git", ["status", "--short"], { cwd: process.cwd() }), []);Source
Section titled “Source”packages/ts/src/sources/node.ts