Repository navigation
fix(win): search the last Path entry in get_shell_path - #1013
Open
kana001-bit wants to merge 1 commit into
Open
kana001-bit wants to merge 1 commit into
kana001-bit wants to merge 1 commit into
Conversation
The loop that splits Path on ';' only kept entries followed by a delimiter, so the last directory was never searched when Path did not end with ';'. Spawning "cmd.exe" with Path set to "C:\NonExistent;C:\Windows\System32" failed with "File not found: ". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
On Windows, a bare shell name such as
cmd.exeis not found when its directory is the last entry inPathandPathdoes not end with;. Spawning then fails withFile not found:.Reported by Roberto Bandini (@robertobandini) in #1006 (comment)
Cause
path_util::get_shell_pathsplitsPathon;, but only keeps an entry once it finds the;after it. The text after the last;is never added, so the last directory is never searched:PathC:\NonExistent;C:\Windows\System32File not found:C:\NonExistent;C:\Windows\System32;C:\Windows\System32;C:\NonExistentFix
After the loop, add what is left in
bufferwhen it is not empty.Tests
Added a
Path lookuptest towindowsTerminal.test.tsthat setsPathtoC:\NonExistent;%windir%\System32(no trailing;), spawnscmd.exe, and restoresPath. It fails withFile not found:before the fix and passes after it, withuseConptyDllboth false and true. All 34 Windows tests pass and lint is clean.This is independent of #1006 (a different branch of the same function); the two PRs touch different lines.
🤖 Generated with Claude Code