Skip to content

fix(tools): resolve PowerShell ENOENT by using full path on Windows#12085

Open
octo-patch wants to merge 1 commit intocontinuedev:mainfrom
octo-patch:fix/issue-12079-powershell-enoent-fullpath
Open

fix(tools): resolve PowerShell ENOENT by using full path on Windows#12085
octo-patch wants to merge 1 commit intocontinuedev:mainfrom
octo-patch:fix/issue-12079-powershell-enoent-fullpath

Conversation

@octo-patch
Copy link
Copy Markdown
Contributor

@octo-patch octo-patch commented Apr 9, 2026

Fixes #12079

Problem

On Windows, the run_terminal_command tool fails with spawn powershell.exe ENOENT for all terminal commands (even simple ones like echo "test"). File creation/editing tools work fine, but nothing that uses the terminal works.

The root cause is that the VSCode extension host process may run with a minimal PATH that does not include %SystemRoot%\System32 (e.g. C:\Windows\System32), where powershell.exe lives. When child_process.spawn("powershell.exe", ...) is called without a full path, Node.js fails to locate the executable.

Solution

Replace the bare "powershell.exe" shell name with the full absolute path constructed from the SystemRoot environment variable, which is always present on Windows:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

SystemRoot is a guaranteed Windows environment variable that points to the Windows installation directory (typically C:\Windows). Using it avoids any dependency on the PATH being set correctly in the extension host.

Testing

  • On non-Windows systems: no change in behavior (the else branch handles Unix/macOS).
  • On Windows: powershell.exe is now resolved via the full path from SystemRoot, bypassing PATH lookup issues.
  • Existing test suite covers the runTerminalCommandImpl function and should continue to pass.

Summary by cubic

Fixes Windows terminal commands failing with "spawn powershell.exe ENOENT" by invoking PowerShell via its absolute path built from the SystemRoot env var (fallback to C:\Windows) instead of relying on PATH. No behavior change on macOS/Linux.

Written for commit 8bdb84d. Summary will update on new commits.

The run_terminal_command tool fails with 'spawn powershell.exe ENOENT'
when the VSCode extension host process PATH does not include Windows
system directories (e.g. %SystemRoot%\System32).

Use the full path to powershell.exe derived from the SystemRoot
environment variable (always present on Windows) instead of relying on
PATH resolution. Falls back to C:\Windows if SystemRoot is unset.

Fixes continuedev#12079
@octo-patch octo-patch requested a review from a team as a code owner April 9, 2026 03:31
@octo-patch octo-patch requested review from sestinj and removed request for a team April 9, 2026 03:31
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


octo-patch seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Terminal/Shell Commands Fail with spawn powershell.exe ENOENT Error

1 participant