Silk

silk/os_child_process

Native ChildProcess provider that executes directly through the platform process boundary.

When to use

Construct OsChildProcess at a native application edge, then provide it to portable code that requires ChildProcess. Tests can supply an in-memory provider without importing this module.

Details

The provider owns no persistent state. It translates low-level spawn and capture reasons into portable ProcessError data, preserves a native numeric code, and copies the complete stdout and stderr captures into independently owned Bytes values. Exit status and signal termination remain ordinary ProcessOutcome data.

Constructing the provider performs no process operation. Portable code invokes ChildProcess.execute after an application provides &mut OsChildProcess for the &mut ChildProcess requirement and supplies an allocator for owned captures.

Gotchas

Reachable OS process operations are native-only. Direct WebAssembly compilation rejects them instead of inventing a process host import; evaluator execution requires an injected host adapter.

Examples

Construct the native provider without starting a process

import silk.os_child_process as OsChildProcess

pub fn main() -> i32 {
  let provider = OsChildProcess.make()
  drop provider
  return 42
}

Import as OsChildProcess with import silk.os_child_process.

Public declarations: 2.

OsChildProcess

pub struct OsChildProcess

A stateless native ChildProcess provider with blocking execution and complete capture.

Details

The provider borrows the request and transfers each completed capture into independent Bytes storage. The returned ProcessOutcome owns that storage.

make

pub fn make() -> OsChildProcess

Creates a stateless provider for the native process boundary.

When to use

Use this function at a native application edge. Provide the result as &mut ChildProcess to portable code that calls ChildProcess.execute or silk.child_process.submit.

Details

Construction starts no process and allocates no storage. Each execution translates native failures into ProcessError and requires an allocator for owned output captures.

Implementation ChildProcess for OsChildProcess

impl ChildProcess for OsChildProcess

Operation execute

execute = OsChildProcess.execute

On this page