Skip to content

fix: inherit argv0 in binary wrapper#298

Open
nikableh wants to merge 1 commit into
sadjow:mainfrom
nikableh-forks:remove-process-binary-path-from-tab-title
Open

fix: inherit argv0 in binary wrapper#298
nikableh wants to merge 1 commit into
sadjow:mainfrom
nikableh-forks:remove-process-binary-path-from-tab-title

Conversation

@nikableh
Copy link
Copy Markdown

Problem

makeBinaryWrapper defaults the wrapped binary's argv[0] to the full .claude-unwrapped store path. That path surfaces verbatim in /proc/<pid>/cmdline.

Terminals that read cmdline for 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-unwrapped

Fix

Add --inherit-argv0 to the makeBinaryWrapper call. The compiled wrapper now forwards the argv[0] it was invoked with into .claude-unwrapped, so cmdline reads claude as expected.

One line, no behavior change beyond argv[0]. claude-code does not dispatch on argv[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 claude instances before and after this PR. Run pgrep -af claude. See the change in /proc/<pid>/cmdline:

cmdline
before 80681 /nix/store/.../bin/.claude-unwrapped
after 86988 claude

Screenshots

Before — full nix store path leaks into Ptyxis tab title:

image

After — title shows claude:

image

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.
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