chiark / gitweb /
startup protocol
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 23 Dec 2020 18:26:53 +0000 (18:26 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 23 Dec 2020 18:26:53 +0000 (18:26 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Cargo.lock.example
wdriver.rs
wdriver/Cargo.toml

index e707f27f9745e459e320bbbe24f9abc198f3a62d..6b157bb65b7aab598f11266cf5d6b72da90daa46 100644 (file)
@@ -1566,6 +1566,7 @@ dependencies = [
  "humantime",
  "libc",
  "nix 0.19.1",
+ "otter",
  "structopt",
  "thirtyfour_sync",
  "void",
index 92e7ffc21b393ad275442e85037f233f196336b0..af0ec3c3c574fbcfd742d7fc2ee721a0bf803223 100644 (file)
@@ -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")?;
index cbf67c01bc8a5a4503cba54c1167ba9345b10742..4e448ab06d4088ef8f9727483411eeb6ea85c275 100644 (file)
@@ -11,6 +11,8 @@ version = "0.0.1"
 edition = "2018"
 
 [dependencies]
+otter = { path = ".." }
+
 anyhow = "1"
 fehler = "1"
 humantime = "2"