process
Shell-free process execution.
This module provides a small argv-based process API. It does not invoke a shell, so arguments are passed as structured values instead of one quoted command string.
Types
Result
Completed captured child process result.
Fields:
code: int- Child exit code.out: bytes::Bytes- Captured stdout bytes.err: bytes::Bytes- Captured stderr bytes.
Functions
throws run(foreign program: String, foreign args: Vec[String]) -> int
Run a child process with inherited stdio and wait for it.
Behavior
- Throws if the child cannot be started or if waiting for it fails.
- A nonzero child exit code is returned, not thrown.
- No shell is invoked.
Parameters
foreign program: String- Executable name or path.foreign args: Vec[String]- Child process arguments.
Returns
- Child exit code.
Notes
argscontains only child arguments, notargv[0].
---
throws capture(foreign program: String, foreign args: Vec[String], region: Region) -> Result
Run a child process, capture stdout and stderr, and wait for it.
Behavior
fails, or pipe reads fail.
- Throws if pipes cannot be created, the child cannot be started, waiting
- A nonzero child exit code is returned in
Result.code, not thrown. - No shell is invoked.
- Stdout and stderr are captured separately as raw bytes.
- Stdin is inherited from the parent process.
Parameters
foreign program: String- Executable name or path.foreign args: Vec[String]- Child process arguments.region: Region- Allocation region for the returned result and captured bytes.
Returns
Resultcontaining the child exit code, stdout bytes, and stderr bytes.
Notes
inspecting it.
argscontains only child arguments, notargv[0].- Captured output may not be valid text. Use
byteshelpers when decoding or