POLYTONE — the AI-native programming language

Guide

Running other programs

Since Sprint 349 the Process capability starts programs — by argv, never through a shell.

echo.pt
import process

fn main(proc: Process) -> Void:
    match proc.run(["echo", "a;b", "$HOME"]):
        case Ok(out):
            print("code {out.code}: {out.stdout.trim()}")
        case Err(e):
            print(e)
    print("a missing program starts: {proc.run(["no-such-program-anywhere"]).is_ok()}")

argv[0] runs directly with the rest as its arguments, so a ; or a $HOME arrives verbatim — the command-injection class cannot be written. Any exit code is an Ok(process.Output) with code, stdout and stderr; only a program that cannot start is an Err. Tests build mock_process(routes), keyed by the argv joined with spaces.