diff --git a/src/webui/server.go b/src/webui/server.go index d897a0ee..a697442f 100644 --- a/src/webui/server.go +++ b/src/webui/server.go @@ -9,10 +9,8 @@ import ( "net" "net/http" "os" - "runtime" "strings" "sync" - "syscall" "time" "github.com/yggdrasil-network/yggdrasil-go/src/admin" @@ -609,18 +607,3 @@ func (w *WebUIServer) restartServer() { w.log.Infof("Please restart Yggdrasil manually to apply configuration changes") } } - -// sendRestartSignal sends a restart signal to the process in a cross-platform way -func sendRestartSignal(proc *os.Process) error { - // Platform-specific signal handling - switch runtime.GOOS { - case "windows": - // Windows doesn't support SIGUSR1, so we'll use a different approach - // For now, we'll just log that manual restart is needed - // In the future, this could be enhanced with Windows-specific restart mechanisms - return fmt.Errorf("automatic restart not supported on Windows") - default: - // Unix-like systems support SIGUSR1 - return proc.Signal(syscall.SIGUSR1) - } -} diff --git a/src/webui/server_unix.go b/src/webui/server_unix.go new file mode 100644 index 00000000..aed6d1ec --- /dev/null +++ b/src/webui/server_unix.go @@ -0,0 +1,13 @@ +//go:build !windows + +package webui + +import ( + "os" + "syscall" +) + +// sendRestartSignal sends a restart signal to the process on Unix-like systems +func sendRestartSignal(proc *os.Process) error { + return proc.Signal(syscall.SIGUSR1) +} diff --git a/src/webui/server_windows.go b/src/webui/server_windows.go new file mode 100644 index 00000000..bc5c77b7 --- /dev/null +++ b/src/webui/server_windows.go @@ -0,0 +1,16 @@ +//go:build windows + +package webui + +import ( + "fmt" + "os" +) + +// sendRestartSignal sends a restart signal to the process on Windows +func sendRestartSignal(proc *os.Process) error { + // Windows doesn't support SIGUSR1, so we'll use a different approach + // For now, we'll just log that manual restart is needed + // In the future, this could be enhanced with Windows-specific restart mechanisms + return fmt.Errorf("automatic restart not supported on Windows") +}