summaryrefslogtreecommitdiff
path: root/src/util.rs
blob: 9933f03af019da63f9f477ef7edece57fbe69afd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Utilities.

use std::net::TcpStream;

const SSH_PORT: i32 = 22;

// Wait for a virtual machine to have opened its SSH port.
pub fn wait_for_ssh(name: &str) {
    let addr = format!("{}:{}", name, SSH_PORT);
    loop {
        if TcpStream::connect(&addr).is_ok() {
            return;
        }
    }
}