fix(shutdown): Fix shutdown command
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user