continuedev / continuedev/continue

Hardcoded legacy Windows PowerShell (powershell.exe) causes runtime failures and degraded UX

Open
#12,410 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:dev-ex kind:bug os:windows
Dominant language
TypeScript
Stars
36k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Before submitting your bug report
Relevant environment info
- OS:Windows
- Continue version:1.545
- IDE version:
- Model:
- config:
  

  
  OR link to agent in Continue hub:
Description
Problem Statement

The codebase currently contains multiple hardcoded invocations of powershell.exe or the legacy powershell command. These specifically target Windows PowerShell 5.1, which is legacy software that no longer receives feature updates.

Modern PowerShell development, including scripts often generated or expected by modern developer tools, focuses heavily on PowerShell Core (pwsh) 6+. PowerShell Core is cross-platform and contains significant language features, performance improvements, and syntax changes not present in version 5.1.

Impact & Friction

  1. Unpredictable and Silent Failures: Running modern PowerShell Core scripts in legacy PowerShell will frequently fail. Because PowerShell 5.1 lacks newer language features (e.g., ternary operators, pipeline chain operators like && and ||, or modern JSON parsing), the execution will fail in ways that are difficult to diagnose. The errors often present as obscure syntax or parsing errors within a sub-shell, obscuring the root cause (a version mismatch).
    
  2. Uncorrectable by the End User: Because the powershell invocation is hardcoded deep within the application logic (such as in clipboard utilities or terminal command execution), this issue is entirely uncorrectable by the end user. Even if a user has explicitly installed PowerShell Core and set it as their default terminal, the application bypasses this configuration and forces the legacy binary.
    
  3. Cross-Platform Inconsistency: Hardcoding powershell.exe makes the execution logic strictly Windows-centric. While non-Windows platforms generally default to pwsh or bash, having fragmented fallback paths leads to inconsistent behaviors and duplicated logic across different extensions and core utilities.
    

Proposed Solution

Implement a centralized, dynamic detection utility that:

  1. Prefers pwsh (PowerShell Core) if it is available in the system environment.
    
  2. Falls back to legacy powershell only as a secondary option on Windows to maintain backward compatibility for systems without Core installed.
    
  3. Consolidates this detection into a single source of truth to eliminate duplicated checks across the CLI and IDE extensions.
    

Note that PowerShell Core (pwsh) is "generally" backwards compatible, and failures center around reliance on Windows-Only OS features. Because PowerShell core supports the "#Requires" construct, which is typically included in scripts that require legacy PowerShell, failures due to backwards incompatibility are very rare.

To reproduce

Create bug_demo.ps1:

# demo.ps1
$version = $PSVersionTable.PSVersion.Major
$result = $version -ge 7 ? "Modern PowerShell $version ✓" : "Legacy"
Write-Host $result

Tell Continue to execute the script. Continue will use 'powershell.exe'
Script fails with Unexpected token '?' in expression or statement., but this is a best-case scenario. There's no workaround — powershell.exe simply cannot parse the file, and reports an error.

A task can invoke at statement like this: ([System.Text.Encoding]::Default.GetBytes("€")).Count. Legacy PowerShell is strictly ASCII, and it silently replaces Unicode with '?'. This kind of statement silently corrupts filenames, prices, config values, or log entries containing any non-ASCII character — which includes most of the world's currencies, names, and languages

Log output

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the CLI and IDE extensions for hardcoded powershell.exe or powershell invocations, including clipboard utilities and terminal command execution. Trace the existing platform-specific execution paths and identify where a shared detection utility belongs. Done means pwsh is preferred when available, legacy powershell remains a Windows fallback, and duplicated checks are removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript
Domain
cli, developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.