Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
latest
sys-repo/sysWorks with
•JSR Score100%•This package works with Deno, Browsers

License
•MIT
Downloads68/wk
•Published2 weeks ago (0.0.317)
Tools for working with spawned child processes.
Examples
Running a short lived shell command (synchronous):
Running a short lived shell command (synchronous):
import { Process } from '@sys/process'; const sh = Process.sh('./path/to/cwd'); const res = await sh.run('echo foo'); // ← res.code == 0 (success) // OR ↓ const args = ['eval', 'console.log("👋 hello world")']; const res = await Process.invoke({ args });
Running an interactive command with inherited terminal stdio:
Running an interactive command with inherited terminal stdio:
import { Process } from '@sys/process'; await Process.inherit({ cmd: 'deno', args: ['task', 'help'] });
Notes:
Process.inheritdoes not capture stdout/stderr.silenthas no effect forinherit.FORCE_COLORdefaults to on (override by settingenv.FORCE_COLOR).
Spawning a long-running child process (asynchronous):
Spawning a long-running child process (asynchronous):
import { Process } from '@sys/process'; const readySignal = Process.Signal.ready; const cmd = ` Deno.serve({ port: 1234 }, () => new Response('👋 hello world')); console.info('${Process.Signal.ready}'); `; const args = ['eval', cmd]; const proc = await Process.spawn({ args, readySignal, silent: true }).whenReady(); await proc.whenReady(); // ... await proc.dispose();
Variables
v
Open: t.OpenLib
Open helpers for launching URLs and paths via the OS default handler in a detached child process.
v
pkg: Pkg
Package metadata.
v
Process: t.Process.Lib
Host and child process capabilities. https://docs.deno.com/api/deno/~/Deno.Command