php/services_unix.go
Snider ad8af2fb83
Some checks failed
CI / PHP 8.4 (push) Failing after 2m5s
CI / PHP 8.3 (push) Failing after 2m10s
feat: merge go-php Go CLI into core/php
Merge all Go code from core/go-php into core/php, creating a dual-language
repo (Go CLI + PHP framework). Module path: forge.lthn.ai/core/php.

- PHP dev/build/deploy/QA commands (cmd_*.go)
- FrankenPHP handler + bridge (handler.go, bridge.go)
- Standalone binary entry point (cmd/core-php/)
- Build/release configs (.core/)
- Full test suite

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 17:50:01 +00:00

41 lines
869 B
Go

//go:build unix
package php
import (
"os/exec"
"syscall"
)
// setSysProcAttr sets Unix-specific process attributes for clean process group handling.
func setSysProcAttr(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
}
}
// signalProcessGroup sends a signal to the process group.
// On Unix, this uses negative PID to signal the entire group.
func signalProcessGroup(cmd *exec.Cmd, sig syscall.Signal) error {
if cmd.Process == nil {
return nil
}
pgid, err := syscall.Getpgid(cmd.Process.Pid)
if err == nil {
return syscall.Kill(-pgid, sig)
}
// Fallback to signaling just the process
return cmd.Process.Signal(sig)
}
// termSignal returns SIGTERM for Unix.
func termSignal() syscall.Signal {
return syscall.SIGTERM
}
// killSignal returns SIGKILL for Unix.
func killSignal() syscall.Signal {
return syscall.SIGKILL
}