fix(shutdown): Fix shutdown command

This commit is contained in:
Björn Benouarets
2025-11-11 20:38:49 +01:00
parent 8ed56f7ba0
commit b8964d7763
4 changed files with 115 additions and 21 deletions

View File

@@ -4,8 +4,9 @@
package system
import (
"log"
"os/exec"
"git.secnex.io/secnex/masterlog"
)
// Shutdown shuts down the system (Windows)
@@ -13,6 +14,12 @@ func Shutdown() {
cmd := exec.Command("shutdown", "/s", "/t", "0")
if err := cmd.Run(); err != nil {
log.Fatalf("Failed to shutdown system: %v", err)
masterlog.Error("Failed to shutdown system", map[string]interface{}{
"error": err,
"note": "The application may need administrator privileges",
})
return
}
masterlog.Info("Shutdown command executed successfully")
}