Skip to content

fix(desktop): open Windows terminals at the project directory - #40067

Closed
tancheng33 wants to merge 1 commit into
anomalyco:devfrom
tancheng33:open-path-terminals
Closed

tancheng33 wants to merge 1 commit into
anomalyco:devfrom
tancheng33:open-path-terminals

Conversation

@tancheng33

Copy link
Copy Markdown

Issue for this PR

Closes #39851

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

On Windows, the open-path IPC handler runs execFile(<app>, [path]) for every app. That works for editors (code, cursor, etc. accept a directory argument), but PowerShell interprets its first positional argument as a command to execute, so "Open in PowerShell" fails with CommandNotFoundException on the project path.

The fix: when the resolved app is powershell/pwsh on win32, spawn it with no arguments, cwd set to the project directory, and detached: true + stdio: "ignore" so it gets its own console window starting in the project folder. A spawn/error listener keeps the promise contract of the handler (rejects on ENOENT etc.). All other apps and platforms keep the existing execFile path.

detached: true on Windows gives the child its own console, and PowerShell starts in the inherited cwd, which is exactly the expected behavior from the issue ("a PowerShell window opens with the working directory set to the project folder").

How did you verify your code works?

Screenshots / recordings

Not a UI change (main-process IPC only).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop: Open in PowerShell fails on Windows — 'open-path' passes project path as a command (CommandNotFoundException)

1 participant