Skip to content
This repository was archived by the owner on Nov 22, 2026. It is now read-only.

mojo-subprocess v0.1.0

Choose a tag to compare

@amarbarosys amarbarosys released this 05 Nov 11:03
· 10 commits to main since this release

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 Python input=b"") and capture_stderr (False leaves stderr on the parent's fd 2).

Verified

  • scripts/ci.sh PASS 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 Popen streaming 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 of env=.

Upgrade / run

  • Add mojo-subprocess (pulls mojo-posix), then from subprocess import run. Try examples/quickstart.mojo.

Commits

  • All commits up to tag v0.1.0: git log v0.1.0.