feat(daemon): add Windows (Git Bash) support to daemon manager - #45
Open
Firegoiste wants to merge 1 commit into
Open
feat(daemon): add Windows (Git Bash) support to daemon manager#45Firegoiste wants to merge 1 commit into
Firegoiste wants to merge 1 commit into
Conversation
Firegoiste
force-pushed
the
feat/windows-daemon-support
branch
from
July 23, 2026 06:45
6f236df to
5014307
Compare
The daemon manager only handled Darwin/Linux; on Windows (MINGW/MSYS/CYGWIN under Git Bash) it exited with "Unsupported platform", so `npm run daemon -- start/stop/status` were unusable there. Add a Windows branch that launches the daemon fully detached via PowerShell Start-Process. macOS/Linux unchanged.
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.
What
Adds Windows (Git Bash) support to
scripts/daemon.sh.Why
The daemon manager only handled
Darwin/Linux. On Windows under Git Bash,uname -sreturnsMINGW64_NT-..., so the script fell through to*)and exited withError: Unsupported platform. That madenpm run daemon -- start|stop|restart|status|logsunusable on Windows, even though the Node daemon itself (dist/main.js) already runs fine there.How
A new
MINGW*|MSYS*|CYGWIN*branch in the dispatcher, backed bywin_*functions that launch the daemon fully detached via PowerShellStart-Process(stdout/stderr redirected to the existing log files). Three Windows-specific pitfalls handled along the way:nohup node &inherits the parent bash's stdio; when that shell exits, the daemon dies withwrite EPIPE.Start-Processdetaches cleanly.$(...)hangs forever, because the detached child inherits the pipe handle and bash never sees EOF. Instead PowerShell writes the child PID straight into the pidfile and the launcher's stdio is fully detached (</dev/null >/dev/null 2>&1).kill -0blindness — MSYSkill -0 <pid>can't see native Windows PIDs (it only tracks processes it spawned). Liveness is checked withtasklist //FI "PID eq <pid>", and stop usestaskkill //T //Fto also reap child processes.Compatibility
macOS (launchd) and Linux (systemd / nohup) code paths are untouched — this is a pure addition (+147 lines, 0 deletions in the logic; header comment updated to mention Windows).
Testing
On Windows 11 + Git Bash, Node 24:
start→ launches detached, writes correct PID, survives the parent shell exiting (no more EPIPE)status→ correctly reports Running/Not running viataskliststop→taskkillreaps the process and childrenstop→start→statuslifecycle verified;startis idempotent (detects an already-running daemon via the pidfile and exits early, no duplicate instance)