pub fn try_get_pid(
    vid: &VmId,
    max_retries: usize,
    delay: Duration
) -> Result<u32, Error>
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);
}