Function vboxhelper::try_get_pid
source · [−]Expand description
Wrapper method around get_pid()
to retry getting the guest’s PID.
use std::time::Duration;
use vboxhelper::{try_get_pid, VmId};
fn impatient() {
let vmid = VmId::from("myvm");
let max_retries = 5;
let two_seconds = Duration::new(2, 0);
let pid = try_get_pid(&vmid, max_retries, two_seconds).unwrap();
println!("Guest's process id in host: {}", pid);
}