From: Ian Jackson Date: Wed, 23 Dec 2020 18:26:53 +0000 (+0000) Subject: startup protocol X-Git-Tag: otter-0.2.0~140 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=35b2bbc5fda56ba920a42634682cc3696faf04ba;p=otter.git startup protocol Signed-off-by: Ian Jackson --- diff --git a/Cargo.lock.example b/Cargo.lock.example index e707f27f..6b157bb6 100644 --- a/Cargo.lock.example +++ b/Cargo.lock.example @@ -1566,6 +1566,7 @@ dependencies = [ "humantime", "libc", "nix 0.19.1", + "otter", "structopt", "thirtyfour_sync", "void", diff --git a/wdriver.rs b/wdriver.rs index 92e7ffc2..af0ec3c3 100644 --- a/wdriver.rs +++ b/wdriver.rs @@ -22,6 +22,8 @@ pub use std::process::{Command, Stdio}; pub use std::thread::sleep; pub use std::time; +use otter::config::DAEMON_STARTUP_REPORT; + pub const MS : time::Duration = time::Duration::from_millis(1); pub type AE = anyhow::Error; @@ -372,15 +374,17 @@ _ = "error" # rocket .context(CONFIG).context("create server config")?; let server_exe = ds.subst("@target@/debug/daemon-otter"); + let mut cmd = Command::new(&server_exe); + cmd + .arg("--report-startup") + .arg(CONFIG); + (||{ - let mut cmd = Command::new(&server_exe); - cmd - .arg("--report-startup") - .arg(CONFIG); - cln.arm_hook(&mut cmd)?; - cmd - .spawn().context("spawn")?; - // we leak it here + let l = fork_something_which_prints(cmd, cln)?; + if l != DAEMON_STARTUP_REPORT { + throw!(anyhow!("otter-daemon startup report {:?}, expected {:?}", + &l, DAEMON_STARTUP_REPORT)); + } Ok::<_,AE>(()) })() .context(server_exe).context("game server")?; diff --git a/wdriver/Cargo.toml b/wdriver/Cargo.toml index cbf67c01..4e448ab0 100644 --- a/wdriver/Cargo.toml +++ b/wdriver/Cargo.toml @@ -11,6 +11,8 @@ version = "0.0.1" edition = "2018" [dependencies] +otter = { path = ".." } + anyhow = "1" fehler = "1" humantime = "2"