Skip to content
PACKAGES

fromSpawn()

Stream stdout, stderr, and exit events from a Node child process.

import { fromSpawn } from "@graphrefly/ts/sources/node";
function fromSpawn(
cmd: string,
args: readonly string[] = [],
opts: FromSpawnOptions = {},
): Operator<never, SpawnEvent>
ParameterTypeDescription
cmdstringExecutable name or absolute path passed to child_process.spawn.
argsreadonly string[]Arguments passed to the child process.
optsFromSpawnOptionsOptional cwd, env, stdio, shell, cancellation, and kill-grace controls.

A node-only source operator that emits SpawnEvent DATA values and terminal ERROR/COMPLETE events.

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() }), []);

packages/ts/src/sources/node.ts