26 lines
491 B
Go
26 lines
491 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package system
|
|
|
|
import (
|
|
"os/exec"
|
|
|
|
"git.secnex.io/secnex/masterlog"
|
|
)
|
|
|
|
// Shutdown shuts down the system (Windows)
|
|
func Shutdown() {
|
|
cmd := exec.Command("shutdown", "/s", "/t", "0")
|
|
|
|
if err := cmd.Run(); err != nil {
|
|
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")
|
|
}
|