Skip to content

Make the default-shell setting control the spawned terminal #47

Description

@jamditis

Problem

The settings UI presents a default-shell choice and saves it in renderer localStorage, but the Electron main process never reads that value. Every Windows PTY starts powershell.exe, while terminal context reports the generic value powershell.

This means the advertised cmd and bash choices do not control the spawned terminal, and Windows PowerShell 5.1 is conflated with PowerShell 7.

Evidence

  • src/components/Settings.tsx:139-145 loads the saved shell only into renderer state.
  • src/components/Settings.tsx:320 writes the shell only to localStorage.
  • src/components/Settings.tsx:790-810 presents the choice as the default shell.
  • src/types.ts:5-10 defines powershell, cmd, and bash, with no distinct PowerShell 7 value.
  • electron/shellQuote.cjs:11-13 always returns powershell.exe on Windows.
  • electron/main.cjs:759-776 uses that result for every PTY.
  • electron/main.cjs:972-983 reports a generic PowerShell terminal context.
  • README.md:145 advertises PowerShell, cmd, or bash selection.

Proposed work

  • Pass a validated shell identifier across the renderer/main boundary or store the selection in the main process.
  • Define exact, allowlisted executable mappings for each supported shell.
  • Represent Windows PowerShell and PowerShell 7 separately.
  • Report the executable recorded in ptyShells when building terminal context.
  • Define migration behavior for the existing saved powershell value.

Acceptance criteria

  • Start with a failing regression test proving that the saved selection does not affect the spawned PTY.
  • Selecting cmd, Windows PowerShell, PowerShell 7, or bash changes the next spawned PTY.
  • Missing executables produce an actionable error instead of silently changing hosts.
  • Terminal context reports the executable used by that PTY.
  • Tests cover selection, saved-value migration, missing executables, and quoting for both PowerShell hosts.

Non-goals

  • Do not accept arbitrary renderer-provided executable paths.
  • Do not replace node-pty or move terminal work into PowerShell or .NET.
  • Preserve the existing safe directory quoting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2medium prioritybugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions