mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-18 05:57:29 +08:00
ci cross-platform fix: avoid syscall.SIGHUP usage on windows via build-tagged self-reload helper
This commit is contained in:
@@ -19,7 +19,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cfgpkg "clawgo/pkg/config"
|
cfgpkg "clawgo/pkg/config"
|
||||||
@@ -357,7 +356,7 @@ func (s *RegistryServer) handleWebUIConfig(w http.ResponseWriter, r *http.Reques
|
|||||||
if s.onConfigAfter != nil {
|
if s.onConfigAfter != nil {
|
||||||
s.onConfigAfter()
|
s.onConfigAfter()
|
||||||
} else {
|
} else {
|
||||||
_ = syscall.Kill(os.Getpid(), syscall.SIGHUP)
|
_ = requestSelfReloadSignal()
|
||||||
}
|
}
|
||||||
_ = json.NewEncoder(w).Encode(map[string]interface{}{"ok": true, "reloaded": true})
|
_ = json.NewEncoder(w).Encode(map[string]interface{}{"ok": true, "reloaded": true})
|
||||||
default:
|
default:
|
||||||
|
|||||||
12
pkg/nodes/reload_unix.go
Normal file
12
pkg/nodes/reload_unix.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package nodes
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func requestSelfReloadSignal() error {
|
||||||
|
return syscall.Kill(os.Getpid(), syscall.SIGHUP)
|
||||||
|
}
|
||||||
8
pkg/nodes/reload_windows.go
Normal file
8
pkg/nodes/reload_windows.go
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package nodes
|
||||||
|
|
||||||
|
// requestSelfReloadSignal is a no-op on Windows (no SIGHUP semantics).
|
||||||
|
func requestSelfReloadSignal() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user