Skip to content

Windows server: sessions on ConPTY, daemon outside the ssh job - #4

Merged
ralyodio merged 3 commits into
mainfrom
feat/windows-server
Oct 6, 2026
Merged

ralyodio merged 3 commits into
mainfrom
feat/windows-server

Conversation

@ralyodio

@ralyodio ralyodio commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Anthony: hqsh must work as a server on every device, Windows included.

  • Refactor: the daemon is platform-neutral (daemon.go) behind a console interface: a PTY on Unix (console_unix.go, the moved code), a pseudo console on Windows (console_windows.go). The session lock, socket mode and dead-socket check moved with them.
  • Windows sessions: run pwsh, else Windows PowerShell, else cmd.exe, on a ConPTY. HQSH_SHELL overrides the shell on every OS.
  • Surviving disconnects: Win32-OpenSSH kills a connection's job on disconnect. The daemon starts with CREATE_BREAKAWAY_FROM_JOB, else via WMI Win32_Process.Create (outside any ssh job), else as a plain detached process.
  • hqsh server setup on Windows: reports the start mode, shell and socket dir.
  • README: Windows hosts and their requirements (OpenSSH server, hqsh.exe on PATH or in ~/.local/bin).

Tests

  • Windows: a cmd.exe session on a real ConPTY. It starts, computes set /a, resizes, survives a disconnect and resumes without a gap, is listed, and returns exit status 7.
  • Unit tests for the WMI command line and the environment block.
  • The portable protocol test clients moved to helpers_test.go.
  • A verbose CI step now shows which service manager each OS actually used.
  • The Linux suite is unchanged and passing; go vet passes for linux, darwin and windows.

🤖 Generated with Claude Code

ralyodio and others added 3 commits October 6, 2026 19:11
The daemon is now platform-neutral (daemon.go) behind a small console
interface: a PTY on Unix (console_unix.go), a pseudo console on Windows
(console_windows.go, CreatePseudoConsole + PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE).
The session lock, socket mode and dead-socket check moved with them.

Windows sessions run pwsh, else Windows PowerShell, else cmd.exe
(HQSH_SHELL overrides, on every OS). The daemon escapes Win32-OpenSSH's
per-connection job with CREATE_BREAKAWAY_FROM_JOB, else Win32_Process.Create
via WMI, else a plain detached process.

Tests: a cmd.exe session on a real ConPTY (start, compute, resize,
disconnect and resume, list, exit status 7); CI prints which service
manager each OS used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l-fast off

macOS CI showed the session falling back to a fork: bootstrap into
user/<uid> fails where the user has a GUI login. Try gui/<uid> first, and
make the real-manager test report launchctl's error instead of only
'not running'. Windows CI refuses breakaway, so WMI is the path there:
test that it starts a process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 2dcb882 into main Oct 6, 2026
5 checks passed
@ralyodio
ralyodio deleted the feat/windows-server branch October 6, 2026 19:16
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.

1 participant