Skip to content

Run commands: choose between bare process and PowerShell host #54

@AThraen

Description

@AThraen

This was generated by AI during triage.

Summary

Add a per-RunCommandItem option to choose whether the command runs as a bare process (current behaviour — the executable is launched directly by ConPTY) or inside a PowerShell session (pwsh -Command … / powershell -Command …).

Motivation

  • Bare process is correct for compiled tools (dotnet, cargo, node, custom exes) — no shell overhead, no profile load, predictable argv.
  • PowerShell host is needed when the command line uses shell syntax: pipes (|), redirection (>), variables ($env:), compound statements (;, &&), or calls to cmdlets and PS functions.
  • Today every run command is launched bare. Users who want shell features have to manually prefix their command with pwsh -Command "…", which is awkward and easy to get wrong.

Proposed behaviour

Data model

Add RunMode (enum: Process / PowerShell) to RunCommandItem. Default: Process (backwards-compatible).

Runtime

In SessionRunner / RunInstance, when RunMode == PowerShell:

  • Launch pwsh.exe -NonInteractive -Command <commandLine> (fall back to powershell.exe if pwsh is not found).
  • Pass -ExecutionPolicy Bypass so scripts run without requiring a policy change.
  • commandLine is passed as-is; the user is responsible for quoting within PS syntax.

Editor UI (SessionRunCommandsDialog)

  • Add a small toggle or dropdown column in the run-command table: Process / PowerShell.
  • Show a tooltip explaining the difference.

Persistence

RunMode serialises to state.json alongside the other RunCommandItem fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions