Repository navigation
fix(win): resolve relative file that exists in the process cwd - #1006
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>
|
@microsoft-github-policy-service agree |
node-pty's get_shell_path returned an empty path when a bare shell name such as cmd.exe existed in the process cwd, so launching Orca with cwd C:\Windows\System32 made Command Prompt and WSL panes fail with "File not found: ". Patch it to return the cwd match, mirroring microsoft/node-pty#1006. Fixes stablyai#17083 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hi kana001-bit! Thank you for the fix. We hit the same bug in Freelens, an Electron app (freelensapp/freelens#2918): with While reading In Freelens we're adding a lookup on |
|
Thanks Roberto Bandini (@robertobandini), good to know it hit Freelens too, and that it still reproduces on 1.2.0-beta.18. I confirmed the second gap: with |
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