Function vboxhelper::wait_for_croak
source · [−]Expand description
Wait for a virtual machine to self-terminate.
The caller can choose to pass a timeout and what action should be taken if the operation times out. If the timeout occurs the caller can choose whether to return a timeout error or kill the virtual machine.
use std::time::Duration;
use vboxhelper::{TimeoutAction, wait_for_croak, VmId};
fn impatient() {
let twenty_seconds = Duration::new(20, 0);
let vmid = VmId::from("myvm");
wait_for_croak(&vmid, Some((twenty_seconds, TimeoutAction::Kill)));
}
This function polls is_vm_state()
which calls get_vm_info()
. A very
sad state of affairs. :(