package sausage:process@0.1.0; /// Programs share one world. These resources provide lifecycle and bounded stdio transport. interface host { use wasi:io/streams@0.2.12.{input-stream, output-stream}; use wasi:io/poll@0.2.12.{pollable}; enum change-kind { created, modified, removed, overflow } record change { path: string, kind: change-kind } resource watcher { constructor(paths: list); subscribe: func() -> pollable; changes: func() -> list; } enum stdio { pipe, inherit, null } record request { program: string, argv: list, env: list>, cwd: string, /// None inherits the parent's group. Zero creates a group. A nonzero ID joins a group. group: option, stdin: stdio, stdout: stdio, stderr: stdio, } resource child { pid: func() -> u32; group: func() -> u32; stdin: func() -> output-stream; stdout: func() -> input-stream; stderr: func() -> input-stream; subscribe: func() -> pollable; status: func() -> option; wait: func() -> s32; kill: func(); } spawn: func(request: request) -> result; kill: func(pid: u32) -> result<_, string>; } world program { import host; }