Fix setup: shell PATH, restart race, Tailscale wait, macOS 27 grants

This commit is contained in:
Ian Gulliver
2026-10-22 20:20:41 -07:00
parent 5ed184e975
commit eed9b40533
10 changed files with 51 additions and 23 deletions
+8 -1
View File
@@ -78,8 +78,15 @@ func installCmd() {
return
}
// bootout kills every process the service started, which includes this one when an agent runs it.
reload := exec.Command("/bin/sh", "-c", `launchctl bootout "$1"; launchctl bootstrap "$2" "$3"`, "sh", service, domain, plistPath)
// It returns before the old server exits, and bootstrap fails while the job is still tearing down.
reload := exec.Command("/bin/sh", "-c", `launchctl bootout "$1"; while launchctl print "$1" >/dev/null 2>&1; do sleep 1; done; launchctl bootstrap "$2" "$3"`, "sh", service, domain, plistPath)
reload.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
logFile, err := os.OpenFile(logPath, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0o644)
if err != nil {
fatal("open log", "err", err)
}
reload.Stdout = logFile
reload.Stderr = logFile
err = reload.Start()
if err != nil {
fatal("restart service", "err", err)