fix: inherit argv0 in binary wrapper#298
Open
nikableh wants to merge 1 commit into
Open
Conversation
makeBinaryWrapper defaults the wrapped binary's argv[0] to the full .claude-unwrapped store path, which surfaces in /proc/PID/cmdline. Terminals that read cmdline for the foreground process (e.g. GNOME Ptyxis) then show the entire nix store path in the tab title instead of "claude". --inherit-argv0 forwards the argv[0] the wrapper was invoked with, so cmdline reads "claude --..." as expected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
makeBinaryWrapperdefaults the wrapped binary'sargv[0]to the full.claude-unwrappedstore path. That path surfaces verbatim in/proc/<pid>/cmdline.Terminals that read
cmdlinefor the foreground process — e.g. GNOME Ptyxis — append it to the tab title. Result: the tab reads✳ Claude Code — /nix/store/b4pviq7rl1j13dsbq55nvpgigvwfcg2z-claude-code-2.1.143/bin/.claude-unwrappedFix
Add
--inherit-argv0to themakeBinaryWrappercall. The compiled wrapper now forwards theargv[0]it was invoked with into.claude-unwrapped, socmdlinereadsclaudeas expected.One line, no behavior change beyond
argv[0]. claude-code does not dispatch onargv[0](not a busybox-style multicall binary), so this is safe.Invoking by absolute path still shows that path — correct, honest behavior, not masked.
Verification
Run two
claudeinstances before and after this PR. Runpgrep -af claude. See the change in/proc/<pid>/cmdline:80681 /nix/store/.../bin/.claude-unwrapped86988 claudeScreenshots
Before — full nix store path leaks into Ptyxis tab title:
After — title shows
claude: