rg (ripgrep 15.2), grep (ours, on ripgrep's regex crates), find and xargs (ours), sed (uutils 0.3 wrapper), diff and cmp (uutils diffutils 0.6 with -r), fd 10.5, jaq 2.3, env and timeout. userland/spawn is a small Command-like client of the process interface. search-test.nu: 42 cases match native tools.
27 lines
1.1 KiB
Markdown
27 lines
1.1 KiB
Markdown
# World process library
|
|
|
|
`sausage-spawn` starts WASI components through `sausage:process/host@0.1.0`.
|
|
It uses `wit-bindgen` 0.46.0 and the canonical `host/wit/process.wit`.
|
|
It adds no host interface.
|
|
|
|
```rust,no_run
|
|
use sausage_spawn::Command;
|
|
let status = Command::new("printenv").arg("FOO").env("FOO", "1").status()?;
|
|
assert_eq!(status, 0);
|
|
# Ok::<(), std::io::Error>(())
|
|
```
|
|
|
|
A command inherits the environment, cwd, and all three streams.
|
|
`Stdio::Pipe` exposes the generated WASI stream resource on `Child`.
|
|
`Stdio::Null` discards output or supplies EOF.
|
|
Drop piped stdin to supply EOF.
|
|
Drain both output pipes before `wait` to prevent a bounded-pipe deadlock.
|
|
`try_wait` returns the numeric status when the child finishes.
|
|
`kill` stops every process in the child's group through the process interface.
|
|
Use `Command::new_group` before spawn when the caller must survive a child kill.
|
|
`timeout` uses a separate child group.
|
|
Drop does not kill the child.
|
|
|
|
Run `nix develop -c nu userland/spawn/check-imports.nu` to inspect the release components.
|
|
The script keeps the complete WIT output and checks each import.
|