feat(doctor): detect when jaw is unreachable from a non-interactive shell (#479) - #485
Merged
Conversation
…hell `ssh host 'jaw serve ...'` runs a non-login, non-interactive shell that reads none of the files scripts/install.sh writes to: bash skips .bash_profile and .profile (login-only) and Debian's stock .bashrc returns at its first line when non-interactive, while zsh reads only .zshenv, which the installer never touches. So ~/.local/bin never makes it onto PATH and the remote command dies with "nohup: failed to run command 'jaw'" — a message that names no PATH. doctor could not see this before, and a naive check could not either: doctor runs in the interactive shell where PATH already works. The check therefore asks the question against `getconf PATH` (what a non-interactive shell actually starts from) rather than process.env.PATH. Candidate install dirs include the caller's own resolved locations (npm prefix, the running binary's dir) because a version-managed Node puts global bins under a prefix no static list can enumerate. Verified on a host with nvm: the check reports unreachable, and `env -i PATH="$(getconf PATH)" sh -c 'command -v jaw'` confirms it resolves nothing. Refs #479
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.
What
jaw doctornow reports whenjawcannot be resolved from a non-interactive shell — the condition behind #479, which is invisible from the shell doctor itself runs in.Why this was invisible
ssh host 'jaw serve ...'runs a non-login, non-interactive shell that reads none of the filesscripts/install.shwrites to:ssh host 'cmd'.bashrc,.bash_profile.bash_profileis login-only, and Debian's stock.bashrcreturns on its first line when non-interactive.zshrc,.zprofile.zshenv.profileSo
~/.local/binnever reaches PATH,nohupfails to resolvejaw, and the only evidence isNo such file or directory— a message that never mentions PATH.A naive check could not catch this either: doctor runs in the interactive shell where PATH already works. The check therefore asks the question against
getconf PATH.Verification
Running it live also caught a real defect before merge: the first version searched only a static list of install dirs, so a version-managed Node (nvm/fnm/Homebrew) read as "not installed" and the check stayed silent on a host that is broken. Candidate dirs now include the caller's resolved npm prefix and binary dir.
11 unit tests (
tests/unit/noninteractive-path.test.ts),tsc --noEmitclean, full suite shows 0 new failures vs an origin/dev baseline.Refs #479
Stack (merge bottom-up):
Review this PR's diff only; its base is the layer below.