This repository was archived by the owner on Nov 22, 2026. It is now read-only.
Repository navigation
mojo-subprocess v0.1.0
mojo-subprocess v0.1.0
What it does
Python's subprocess.run for Mojo: capture, input, timeout, cwd, env, check.
Highlights
- Deadlock-free on large outputs: one poll loop over all pipes plus a pidfd.
run(["true"])in about 0.4 ms; 0.6 GB/s through a pipe.
Changes
- First release:
run,check_output(stderr passes through to the parent),CompletedProcess. close_stdin(child reads an empty stdin, EOF, like Pythoninput=b"") andcapture_stderr(False leaves stderr on the parent's fd 2).
Verified
scripts/ci.shPASS on Mojo 1.2.0 and 1.3.0.dev2026110305: 4 scenarios byte-identical with Python subprocess (codes, signals, floods, input, cwd/env, errors), each twice; 6/6 mutants.
Known limits
- Linux only (posix_spawn file actions with addchdir_np, pidfd). No
Popenstreaming API, no shell=True, no stdin from a file. - Needs glibc >= 2.29 (
posix_spawn_file_actions_addchdir_np). The program is looked up in the PATH of the parent's environment, not ofenv=.
Upgrade / run
- Add
mojo-subprocess(pullsmojo-posix), thenfrom subprocess import run. Tryexamples/quickstart.mojo.
Commits
- All commits up to tag
v0.1.0:git log v0.1.0.