feat(system): enhance system architecture
build-and-release / release (push) Successful in 2m39s

This commit is contained in:
2026-06-25 14:44:47 +02:00
parent 54108c263f
commit d4364a6cb7
17 changed files with 783 additions and 617 deletions
+18
View File
@@ -14,6 +14,7 @@ import (
"os/exec"
"strings"
"sync"
"syscall"
"time"
)
@@ -276,6 +277,23 @@ func ParseKV(lines []string) map[string]string {
return m
}
// RunDetached starts name with args in a new process group (Setsid) and returns
// immediately once the child has started. The child is reaped in the background
// so it does not become a zombie.
//
// Use this for operations where the synchronous path would kill the caller
// (e.g. "systemctl restart nadir" would SIGTERM the process serving the
// request before the response is written).
func RunDetached(name string, args ...string) (*StatusOutput, error) {
cmd := exec.Command(name, args...)
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
if err := cmd.Start(); err != nil {
return nil, err
}
go cmd.Wait()
return OK(), nil
}
// StatusOutput is the shared response for write operations that just report
// success. Reusing one type means all such endpoints share a single OpenAPI
// schema.