Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
test(host): stop test hosts with SIGTERM so they don't orphan children
leepokai15c0ebe63933
diff --git a/host/tests/common/mod.rs b/host/tests/common/mod.rsnew file mode 100644index 00000000..17c4cc38--- /dev/null+++ b/host/tests/common/mod.rs@@ -0,0 +1,20 @@+//! Shared by the end-to-end tests.++use std::process::{Child, Command};+use std::time::{Duration, Instant};++/// Stops a test host the way launchd does (SIGTERM), so it shuts down its own+/// children: a SIGKILL would orphan whatever it had running, such as a harness+/// sign-in check (`cursor-agent status` then spins forever). Kills it after 5 s.+pub fn stop(child: &mut Child) {+ let _ = Command::new("kill").arg(child.id().to_string()).status();+ let deadline = Instant::now() + Duration::from_secs(5);+ while Instant::now() < deadline {+ if let Ok(Some(_)) = child.try_wait() {+ return;+ }+ std::thread::sleep(Duration::from_millis(20));+ }+ let _ = child.kill();+ let _ = child.wait();+}diff --git a/host/tests/e2e.rs b/host/tests/e2e.rsindex b008f784..e334f8e5 100644--- a/host/tests/e2e.rs+++ b/host/tests/e2e.rs@@ -3,6 +3,8 @@#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] // test code: failing loudly is the point+mod common;+/// The host's wire crypto doubles as this test's device implementation.#[path = "../src/remote/crypto.rs"]#[allow(dead_code)]@@ -24,7 +26,7 @@ struct Host {impl Drop for Host {fn drop(&mut self) {- let _ = self.child.kill();+ common::stop(&mut self.child);let _ = std::fs::remove_dir_all(&self.home);}}diff --git a/host/tests/routines_e2e.rs b/host/tests/routines_e2e.rsindex 738f35c4..478e9748 100644--- a/host/tests/routines_e2e.rs+++ b/host/tests/routines_e2e.rs@@ -3,6 +3,8 @@#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]+mod common;+use serde_json::{Value, json};use std::path::PathBuf;use std::process::{Child, Command, Stdio};@@ -17,8 +19,7 @@ struct Host {impl Drop for Host {fn drop(&mut self) {- let _ = self.child.kill();- let _ = self.child.wait();+ common::stop(&mut self.child);let _ = std::fs::remove_dir_all(&self.home);}}@@ -49,8 +50,7 @@ impl Host {}async fn restart(&mut self) {- self.child.kill().unwrap();- self.child.wait().unwrap();+ common::stop(&mut self.child);let port = self.base.rsplit(':').next().unwrap();self.child = Command::new(env!("CARGO_BIN_EXE_codync-host")).args(["serve", "--bind", "127.0.0.1", "--port", port])diff --git a/host/tests/team_e2e.rs b/host/tests/team_e2e.rsindex e3fb685e..9a33644e 100644--- a/host/tests/team_e2e.rs+++ b/host/tests/team_e2e.rs@@ -3,6 +3,8 @@#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]+mod common;+use serde_json::{Value, json};use std::path::PathBuf;use std::process::{Child, Command, Stdio};@@ -17,8 +19,7 @@ struct Host {impl Drop for Host {fn drop(&mut self) {- let _ = self.child.kill();- let _ = self.child.wait();+ common::stop(&mut self.child);let _ = std::fs::remove_dir_all(&self.home);}}