Files
beads/cmd/bd/daemon_unix.go
Steve Yegge a86f3e139e Add native Windows support (#91)
- Native Windows daemon using TCP loopback endpoints
- Direct-mode fallback for CLI/daemon compatibility
- Comment operations over RPC
- PowerShell installer script
- Go 1.24 requirement
- Cross-OS testing documented

Co-authored-by: danshapiro <danshapiro@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-c6230265-055f-4af1-9712-4481061886db
Co-authored-by: Amp <amp@ampcode.com>
2025-10-20 21:08:49 -07:00

29 lines
599 B
Go

//go:build unix || linux || darwin
package main
import (
"os"
"os/exec"
"syscall"
)
var daemonSignals = []os.Signal{syscall.SIGTERM, syscall.SIGINT, syscall.SIGHUP}
// configureDaemonProcess sets up platform-specific process attributes for daemon
func configureDaemonProcess(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
}
func sendStopSignal(process *os.Process) error {
return process.Signal(syscall.SIGTERM)
}
func isReloadSignal(sig os.Signal) bool {
return sig == syscall.SIGHUP
}
func isProcessRunning(pid int) bool {
return syscall.Kill(pid, 0) == nil
}