add TestMode to run actions without effect

This commit is contained in:
2023-08-16 01:27:28 +02:00
parent 381cc31d4b
commit 8f6fc72bfb
7 changed files with 56 additions and 20 deletions

View File

@@ -11,6 +11,13 @@ type Shutdown struct {
ActionChan chan bool
}
func (c Shutdown) DryExecute() {
fmt.Println("Test Shutdown executed...")
c.ActionChan <- true
}
func (c Shutdown) Execute() {
if err := exec.Command("shutdown", "-h", "now").Run(); err != nil {
fmt.Println("Failed to initiate shutdown:", err)