fix(terminal/windows): pipes fallback for v0.7.1 #6

Merged
Muyue merged 3 commits from release/v0.7.1 into develop 2026-04-27 09:59:15 +00:00
Owner

Bugfix Windows : terminal inutilisable

Symptômes (rapportés par l'utilisateur)

  • Sous Windows, l'installation et l'ouverture marchent.
  • Onglet Terminal : détection OK (le menu liste les distros WSL, pwsh, cmd…).
  • Au clic sur n'importe quelle entrée : message unsupported ou connection closed avant même que la bannière s'affiche.

Cause

creack/pty/v2 n'a pas de support Windows natif ; pty.Start() retourne immédiatement operating system not supported. Le handler envoyait l'erreur en WS et fermait. La détection des terminaux marchait (wsl --list --quiet côté Windows OK) mais aucun terminal ne pouvait s'ouvrir.

Fix

Abstraction termSession (internal/api/terminal_session.go) avec deux implémentations sélectionnées au runtime :

  • ptySession (Linux / macOS / BSDs) : comportement existant, TTY complet, resize, vim/top fonctionnent.
  • pipeSession (Windows) : pipes natifs stdin + stdout/stderr mergés. Suffisant pour wsl.exe, pwsh.exe, cmd.exe en mode ligne. Resize = no-op (pas de SIGWINCH sans TTY) → les TUIs plein écran ne marchent pas, mais les commandes shell classiques oui.

handleTerminalWS passe par startTermSession(cmd) ; le chemin Unix est inchangé, le fallback Windows s'active uniquement quand pty.Start aurait échoué.

Versioning

  • v0.7.0 → v0.7.1 (patch)
  • CHANGELOG.md mis à jour

Test plan

  • go vet ./... (Linux + Windows)
  • go test ./...
  • manuel Linux/macOS : régression — terminal local + WSL + SSH continuent de fonctionner avec PTY
  • manuel Windows : cliquer "Default Shell" / "WSL: Ubuntu" / "PowerShell" → la bannière apparaît, on peut taper et voir la sortie

Limitation connue (Windows)

Apps TUI (vim, nano, htop, top) ne fonctionneront pas correctement en mode pipes. Pour le full TTY sous Windows il faudra ajouter une dépendance ConPTY (out of scope ici).

## Bugfix Windows : terminal inutilisable ### Symptômes (rapportés par l'utilisateur) - Sous Windows, l'installation et l'ouverture marchent. - Onglet Terminal : **détection OK** (le menu liste les distros WSL, pwsh, cmd…). - Au **clic sur n'importe quelle entrée** : message `unsupported` ou `connection closed` *avant même que la bannière s'affiche*. ### Cause `creack/pty/v2` n'a **pas de support Windows natif** ; `pty.Start()` retourne immédiatement `operating system not supported`. Le handler envoyait l'erreur en WS et fermait. La détection des terminaux marchait (`wsl --list --quiet` côté Windows OK) mais aucun terminal ne pouvait s'ouvrir. ### Fix Abstraction `termSession` (`internal/api/terminal_session.go`) avec deux implémentations sélectionnées au runtime : - **`ptySession`** (Linux / macOS / BSDs) : comportement existant, TTY complet, resize, vim/top fonctionnent. - **`pipeSession`** (Windows) : pipes natifs `stdin` + `stdout/stderr` mergés. Suffisant pour `wsl.exe`, `pwsh.exe`, `cmd.exe` en mode ligne. Resize = no-op (pas de SIGWINCH sans TTY) → les TUIs plein écran ne marchent pas, mais les commandes shell classiques oui. `handleTerminalWS` passe par `startTermSession(cmd)` ; le chemin Unix est inchangé, le fallback Windows s'active uniquement quand `pty.Start` aurait échoué. ### Versioning - v0.7.0 → v0.7.1 (patch) - CHANGELOG.md mis à jour ### Test plan - [ ] go vet ./... (Linux + Windows) - [ ] go test ./... - [ ] manuel Linux/macOS : régression — terminal local + WSL + SSH continuent de fonctionner avec PTY - [ ] manuel Windows : cliquer "Default Shell" / "WSL: Ubuntu" / "PowerShell" → la bannière apparaît, on peut taper et voir la sortie ### Limitation connue (Windows) Apps TUI (`vim`, `nano`, `htop`, `top`) ne fonctionneront pas correctement en mode pipes. Pour le full TTY sous Windows il faudra ajouter une dépendance ConPTY (out of scope ici).
Muyue added 3 commits 2026-04-27 09:57:14 +00:00
Merge pull request 'release: v0.7.0 stable — promote develop to main' (#5) from develop into main
All checks were successful
Stable Release / stable (push) Successful in 1m1s
991878939b
Reviewed-on: #5
fix(terminal/windows): fallback to pipes when PTY unsupported (v0.7.1)
All checks were successful
PR Check / check (pull_request) Successful in 57s
fc7a5b9d87
The terminal tab was unusable on Windows: creack/pty has no native
Windows ConPTY support, so pty.Start() returned "operating system not
supported" and the WebSocket closed immediately on any tab click —
even though the menu detection (wsl --list --quiet, pwsh, cmd) worked.

Introduce a termSession interface with two implementations selected at
runtime:
- ptySession (unix): unchanged behaviour, real PTY via creack/pty,
  resize works, vim/top behave normally.
- pipeSession (windows): plain stdin + merged stdout/stderr pipes,
  forwarded to the WebSocket. Resize is a no-op (no SIGWINCH without a
  TTY), so full-screen TUIs misbehave in this mode — but launching
  wsl.exe, pwsh, or cmd works for line-based interaction, which is
  what the menu shortcuts target.

handleTerminalWS now goes through startTermSession(cmd); the unix path
is unchanged, the windows fallback kicks in only when pty.Start would
have failed.

Bump v0.7.0 → v0.7.1; CHANGELOG entry added.
Muyue merged commit 0ee006f71f into develop 2026-04-27 09:59:15 +00:00
Muyue deleted branch release/v0.7.1 2026-04-27 09:59:18 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Muyue/MuyueWorkspace#6