Repositories / agent-snapshot.git
test_programs/fork_and_usr.py
Clone (read-only): git clone http://git.guha-anderson.com/git/agent-snapshot.git
import os
from pathlib import Path
testdata = Path(os.environ["AGENT_SNAPSHOT_TEST_REPO"])
pid = os.fork()
if pid == 0:
(testdata / "child_output.txt").write_text("child final\n")
os._exit(0)
with open("/usr/bin/env", "rb") as handle:
handle.read(16)
for _ in testdata.iterdir():
pass
os.waitpid(pid, 0)