Skip to content

Commit

Permalink
check stopped VM before stopping again
Browse files Browse the repository at this point in the history
  • Loading branch information
mhewedy committed Aug 17, 2020
1 parent 856ec21 commit 9d52199
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vms/vms.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func Stop(vmName string) error {
return err
}

if !isRunningVM(vmName) {
return fmt.Errorf(`VM already stopped, use "vermin start %s" to start the VM.`, vmName)
}

progress.Immediate("Stopping", vmName)
if _, err := command.VBoxManage("controlvm", vmName, "poweroff").Call(); err != nil {
return err
Expand Down

0 comments on commit 9d52199

Please sign in to comment.