fix: resolve posix_spawnp and nested session spawn failures on macOS#9
Open
k7cfo wants to merge 1 commit intoArk0N:masterfrom
Open
fix: resolve posix_spawnp and nested session spawn failures on macOS#9k7cfo wants to merge 1 commit intoArk0N:masterfrom
k7cfo wants to merge 1 commit intoArk0N:masterfrom
Conversation
Two issues prevented Claude from spawning in certain environments:
1. node-pty's spawn-helper binary loses execute permission during npm
install, causing posix_spawnp to fail on every PTY spawn. Fixed by
adding chmod in postinstall.
2. When Claudeman is launched from within a Claude Code session, the
CLAUDECODE env var leaks into child processes, causing Claude CLI
to refuse to start ("cannot be launched inside another Claude Code
session"). Fixed by unsetting CLAUDECODE in both tmux and direct
PTY spawn paths.
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.
Summary
Two issues prevent Claude from spawning in certain environments on macOS:
posix_spawnp failed:node-pty'sspawn-helperprebuild binary loses its execute permission duringnpm install, causing everypty.spawn()call to fail. Fixed by addingchmod +xinpostinstall.jsfor the darwin prebuilds.CLAUDECODEenv var leak: When Claudeman is launched from within an existing Claude Code session (e.g. via Claude Code's Bash tool), theCLAUDECODE=1environment variable propagates into tmux and direct PTY child processes. Claude CLI detects this and refuses to start with "cannot be launched inside another Claude Code session". Fixed by unsettingCLAUDECODEin both the tmux session command and the direct PTYenvobject.Changes
scripts/postinstall.js— chmodspawn-helperprebuilds to755after installsrc/tmux-manager.ts— prependunset CLAUDECODEto tmux session env exportssrc/session.ts— deleteCLAUDECODEfrom env passed topty.spawn()in all three spawn paths (tmux attach, direct PTY, shell mux attach)Test plan
npm run buildpassesclaudeman webstarts and sessions spawn Claude successfully after fix