Skip to content

fix(windows): detect pwsh.exe parent process and route commands through pwsh - #749

Merged
dwash96 merged 3 commits into
cecli-dev:v1.13.0from
philippeback:fix/windows-pwsh-detection
Nov 15, 2026
Merged

dwash96 merged 3 commits into
cecli-dev:v1.13.0from
philippeback:fix/windows-pwsh-detection

Conversation

@philippeback

@philippeback philippeback commented Nov 13, 2026 •

Copy link
Copy Markdown

Closes #750

Summary

get_windows_parent_process_name() in cecli/run_cmd.py only checked for powershell.exe and cmd.exe, missing PowerShell 7 (pwsh.exe). When cecli was launched from pwsh.exe, run_cmd_subprocess and run_cmd_async fell back to cmd.exe (shell=True), breaking PowerShell commands (Get-ChildItem, Get-Content, ls, etc.).

Changes

  • Detect pwsh.exe alongside powershell.exe and cmd.exe in get_windows_parent_process_name().
  • Extract _wrap_windows_powershell_command() helper to deduplicate the -EncodedCommand wrapping across run_cmd_subprocess and run_cmd_async, invoking pwsh when parent_process == "pwsh.exe" and powershell when parent_process == "powershell.exe".
  • Add unit tests in tests/basic/test_run_cmd.py.

Testing

  • pytest tests/basic/test_run_cmd.py -q (5 passed).

@dwash96
dwash96 changed the base branch from main to v1.13.0 November 15, 2026 04:33
@dwash96
dwash96 merged commit 01f9af6 into cecli-dev:v1.13.0 Nov 15, 2026
@dwash96 dwash96 mentioned this pull request Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows Shell falls back to cmd.exe when launched from PowerShell 7 (pwsh.exe)

2 participants