feat: add Windows support for pinixd and pinix CLI - #133
Open
yan5xu wants to merge 5 commits into
Open
Conversation
- Add process_windows.go with Windows-specific daemon process management (CREATE_NEW_PROCESS_GROUP, OpenProcess, GenerateConsoleCtrlEvent) - Replace syscall.Flock with cross-platform file locking (LockFileEx/UnlockFileEx on Windows, syscall.Flock on Unix) - Extract bb-browser process group management into platform files (Setpgid on Unix, CREATE_NEW_PROCESS_GROUP on Windows) - Replace Process.Signal(SIGTERM) with platform-gated sendTermSignal - Replace Signal(0) liveness check with OpenProcess on Windows - Use os.Interrupt instead of syscall.SIGTERM for signal.NotifyContext - Add .exe suffix and Windows path for bun binary detection - Add symlink fallback to file copy for Windows without Developer Mode - Fix path concatenation to use filepath.Join - Add windows/amd64 build target to Makefile Closes #132
Contributor
Author
Windows 实测结果在 Windows Server 2022 (10.0.20348) 上完成端到端测试。 环境
测试结果
已知问题
核心功能(Hub、Runtime、Clip 安装和运行)全部正常。 daemon 化问题开单独 issue 跟踪。 |
On Windows, OpenSSH Server places all session processes in a Job Object with 'Kill on Job Close' and without 'Breakaway OK'. This means any child process — even with DETACHED_PROCESS or CREATE_BREAKAWAY_FROM_JOB — gets killed when the SSH session ends. Fix: on Windows, 'pinix start' now launches the daemon via a Windows Scheduled Task (schtasks), which runs outside the SSH Job Object. This is the standard workaround recommended by the Win32-OpenSSH project (PowerShell/Win32-OpenSSH#1032). Also: - Add SetConsoleCtrlHandler(NULL, TRUE) to ignore CTRL_CLOSE_EVENT - Use DETACHED_PROCESS instead of CREATE_NO_WINDOW for daemon detach - Use Process.Release() to detach Go process handle - Extract startBackgroundDaemon into platform files Verified on Windows Server 2022: pinix start -> SSH disconnect -> new SSH session -> pinix hub list shows clips -> pinix invoke works -> pinix stop works.
Usage: irm dl.pinixai.com/install.ps1 | iex - Downloads pinix.exe + pinixd.exe to ~/.pinix/bin/ - Adds to user PATH - Auto-installs Bun from npmmirror (China-friendly) - Updates Makefile upload-cos to include Windows binaries and install.ps1
…r + bb-viewer) One command installs everything: irm dl.pinixai.com/install.ps1 | iex Components installed: 1. pinix.exe + pinixd.exe -> ~/.pinix/bin/ 2. Bun (from npmmirror) -> ~/.bun/bin/ 3. Node.js (from npmmirror) -> ~/.node/ 4. bb-browser (npm) -> global 5. bb-viewer + DLLs -> ~/.bb-browser/bin/ All downloads use China-friendly mirrors (npmmirror). Idempotent: skips already-installed components.
yan5xu
force-pushed
the
feat/windows-support
branch
2 times, most recently
from
June 2, 2026 11:12
6b69559 to
9603125
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
让
pinixd和pinixCLI 能在 Windows 上编译和运行。Changes
新文件 (9 个平台文件)
cmd/pinix/process_windows.godaemonSysProcAttr,checkProcessAlive,signalProcess的 Windows 实现cmd/pinix/daemon_process_unix.gocmd/pinix/daemon_process_windows.gointernal/daemon/registry_flock_unix.gointernal/daemon/registry_flock_windows.gointernal/daemon/process_signal_unix.gointernal/daemon/process_signal_windows.gointernal/pidfile/pidfile_unix.gointernal/pidfile/pidfile_windows.go修改文件 (8 个)
syscall.Flock,改用跨平台lockFile/unlockFilesyscall.Kill(-pid),Setpgid,SIGTERM,改用平台函数stopProcess用sendTermSignal;findBunBinary加.exe和 Windows 路径Signal(0)改用isProcessAlivesignal.NotifyContext用os.Interrupt替代syscall.SIGTERMfilepath.Join替代手动/拼接;用os.Interrupt替代syscall.SIGTERMwindows/amd64构建目标Verification
Closes #132