vtz exposes a subset ofDocumentation Index
Fetch the complete documentation index at: https://docs.vertz.dev/llms.txt
Use this file to discover all available pages before exploring further.
node:child_process. Import what you need and use it the same way you would in Node.
What works
| API | Kind | Use for |
|---|---|---|
spawn(cmd, args, opts) | async | Long-running child, streaming stdout/stderr, manual kill. |
execFile(file, args, opts, cb) | async | One-shot execution, capture all output at the end. |
execFileSync(file, args, opts) | sync | Build scripts, config loaders, tests. |
execSync(cmd, opts) | sync | Same, but the command runs through a shell — prefer execFileSync when you can. |
spawnSync and fork are not implemented.
From a request handler
Use the async forms —spawn or execFile — so a slow subprocess doesn’t block the event loop for other requests.
Capturing output once
When you don’t need to stream,execFile collects stdout and stderr for you:
Sync in scripts only
execSync / execFileSync block the whole runtime until the child exits. That’s fine in a build script, a migration step, or a test. It is not fine in a request handler — a 10-second subprocess makes every concurrent request wait 10 seconds.
Input validation — no implicit sandbox
vtz does not sandboxspawn. Any binary the host can run, a handler can run. Two practical rules:
-
Never build commands by string concatenation with user input.
execSync('convert ' + userPath)is a shell injection waiting to happen. Usespawn/execFilewith an argument array — the child receives each arg verbatim, no shell expansion. -
Validate paths and identifiers before they reach
spawn. Even with arg arrays, some tools interpret their own args (e.g.ffmpegreads from URLs when passed one as input). Normalize and allowlist user-supplied values before they become command arguments.
Signals and cleanup
spawn returns a ChildProcess with .kill(signal). Supported signals: SIGTERM (default), SIGKILL, SIGINT, SIGHUP.
AbortSignal or attach an on('exit') handler and await it — the same pattern as Node.
What’s not supported
spawnSync— useexecFileSyncinstead.fork— no IPC channel with child Node processes. For worker-style concurrency, split work into separate services.- Bun-style
Bun.spawn()/ Deno-styleDeno.Command— usenode:child_process.
Implementation
Rust ops live innative/vtz/src/runtime/ops/process.rs; the node:child_process synthetic module is wired in native/vtz/src/runtime/module_loader.rs.