Skip to content

chore(exec): set arg0 explicitly when spawning via PATH#8

Merged
Pawank06 merged 1 commit intomainfrom
chore/add-arg0
Jan 4, 2026
Merged

chore(exec): set arg0 explicitly when spawning via PATH#8
Pawank06 merged 1 commit intomainfrom
chore/add-arg0

Conversation

@Pawank06
Copy link
Owner

@Pawank06 Pawank06 commented Jan 4, 2026

summary

  • set arg0 explicitly when spawning processes via PATH
  • ensure correct argv[0] behavior for executed programs

notes

  • improves compatibility with unix program expectations
  • no user-visible behavior change

…gravity/antigravity/bin:/Users/naruto/.bun/bin:/opt/homebrew/opt/node@24/bin:/Users/naruto/.codeium/windsurf/bin:/Users/naruto/.local/share/solana/install/active_release/bin:/Users/naruto/.nvm/versions/node/v24.3.0/bin:/Users/naruto/.local/share/solana/install/active_release/bin:/Users/naruto/.local/share/solana/install/active_release/bin:/Users/naruto/.nvm/versions/node/v24.3.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin:/Users/naruto/.antigravity/antigravity/bin:/Users/naruto/.bun/bin:/opt/homebrew/opt/node@24/bin:/Users/naruto/.codeium/windsurf/bin:/Users/naruto/.local/share/solana/install/active_release/bin:/Users/naruto/.nvm/versions/node/v24.3.0/bin:/Users/naruto/.cargo/bin:/Users/naruto/.foundry/bin.
@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

📝 Walkthrough

Walkthrough

This PR modifies Unix command execution in src/main.rs to use borrowed path references and set the original command name as argv[0] via CommandExt::arg0() in both type-resolved and path-based fallback execution paths.

Changes

Cohort / File(s) Summary
Unix command execution enhancement
src/main.rs
Added std::os::unix::process::CommandExt import. Modified command invocation to use borrowed path references (Command::new(&full_path) instead of Command::new(full_path)) and prepended .arg0(command) before .args(...) in type command resolution and path-based fallback execution to set argv[0] to the original command name.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A Unix tale, so neat and true,
argv[0] now matches what we do,
Borrowed paths and borrowed grace,
Commands run in their rightful place!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: explicitly setting arg0 when spawning processes via PATH, which is the core modification made in the pull request.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 96ed79a and 04e5352.

📒 Files selected for processing (1)
  • src/main.rs
🔇 Additional comments (2)
src/main.rs (2)

3-3: LGTM! Unix-specific import is consistent with existing code.

The CommandExt import is necessary for the arg0() method and aligns with the existing Unix-specific imports (e.g., PermissionsExt on line 6). The codebase appears intentionally Unix-specific.


105-106: LGTM! Correctly implements Unix argv[0] conventions.

The changes properly set argv[0] to the original command name when executing via PATH lookup. Using &full_path (reference) is correct and necessary here. This aligns with standard Unix shell behavior where argv[0] reflects the command name (e.g., "ls") rather than the resolved path (e.g., "/bin/ls").

The direct path execution (lines 76-85) correctly remains unchanged—when users specify a full path, argv[0] should reflect what they typed.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Pawank06 Pawank06 merged commit dd06b20 into main Jan 4, 2026
2 checks passed
@Pawank06 Pawank06 deleted the chore/add-arg0 branch January 4, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant