Repository navigation
fix(win): resolve relative file that exists in the process cwd - #1006
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
get_shell_path returned an empty string when the relative file name existed in the current working directory, so spawning e.g. "cmd.exe" from a process whose cwd is C:\Windows\System32 failed with "File not found: " and an empty path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
@microsoft-github-policy-service agree |
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.
Fixes #1005
On Windows, spawning a shell by bare name (e.g.
cmd.exe) fails withFile not found:and an empty path when the calling process's current working directory contains that file, e.g. when an Electron app is launched with its cwd set toC:\Windows\System32.Cause
path_util::get_shell_pathfirst checks whether the relative name exists in the process cwd, but in that case it returnsshellpath, which is still empty:startProcessthen rejects the empty path, so the error message also shows no path.Fix
Return
filenamewhen it exists in the cwd. The resolved path is only used for the existence check instartProcess; the process itself is still created from the command line, and the cwd is part of the normalCreateProcessWsearch order, so the spawn behaves the same as it does from any other cwd.Repro
Tests
Added a
relative filetest towindowsTerminal.test.tsthat changes the process cwd to%windir%\System32and spawnscmd.exe. It fails withFile not found:before the fix and passes after it, withuseConptyDllboth false and true.Found while debugging a downstream report in Orca: stablyai/orca#17083
🤖 Generated with Claude Code