Repository navigation
fix: pass real environment to Threaded io for process spawning - #608
Conversation
processSpawnImpl/processSpawnPathImpl created Io.Threaded with default InitOptions (environ = .empty), causing FileNotFound for any binary requiring PATH resolution (e.g. 'true', 'false', 'sleep'). Add processEnviron() helper that constructs std.process.Environ from the real process environment (std.c.environ on POSIX, .global on Windows). Also re-enable ev/test/process_wait.zig with 3 ProcessWait integration tests and add a negative FileNotFound test to process.zig.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesProcess spawning now selects an explicit environment for each platform and libc configuration. Tests cover child exit codes, SIGKILL termination, and nonexistent executables. Process spawning and wait coverage
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/ev/test/process_wait.zig`:
- Around line 7-20: Update the POSIX branches of argv_exit0, argv_exit1, and
argv_kill_self to invoke "sh" by name instead of hard-coding "/bin/sh",
preserving their existing command arguments and Windows branches.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: fb7362c4-2799-469e-af18-04fd2c0dc393
📒 Files selected for processing (3)
src/ev/test/process_wait.zigsrc/io.zigsrc/process.zig
Process spawn fails with FileNotFound for PATH-dependent binaries
processSpawnImpl in src/io.zig created a temporary Io.Threaded with default InitOptions, where environ defaults to .empty. This caused std.process.spawn(rt.io(), ...) to fail with FileNotFound for any binary requiring PATH resolution (e.g. "true", "false", "sleep"), because the Threaded io had no PATH variable to look up.
Root Cause
Io.Threaded.InitOptions.environ defaults to .empty (
std/Io/Threaded.zig:1600). With no PATH, the fallback default_PATH (/usr/local/bin:/bin:/usr/bin) misses binaries on NixOS, Homebrew, and other non-standard layouts.