feat: phase 2 — am lab (benchmark N agents) + plugins d'événements (contrat JSON)
- #62: am lab --agents a,b --task <f> — séquentiel ou --parallel, capture durée/exit/sortie/coût estimé, rapport comparatif tableau + --json stable, tâches versionnables dans <state>/lab/ (--list), rejouables à l'identique - #75: plugins/ sous state_dir, déclenchés sur on_install/on_start/on_stop/ on_update (App::emit), contrat JSON stdin/stdout, timeout configurable, échec non bloquant, garde anti-récursion AM_PLUGINS_RUNNING, am plugins + am plugins --test <name> (CI), exemples notify + ci-webhook - intégration REPL (parse, complétion, bannière, is_am_command), help, tips, man pages (am-lab.1, am-plugins.1), README, ROADMAP (26/27), v0.5.4 - 334 tests verts (309 + 25) closes #62 closes #75
This commit is contained in:
@@ -90,6 +90,27 @@ pub fn stop_pid(pid: u32, force: bool, timeout_secs: u64) -> bool {
|
||||
!is_running(pid)
|
||||
}
|
||||
|
||||
/// Kill a process and its whole tree (process group on unix, taskkill /T on
|
||||
/// Windows). Used by the plugin runner and the lab benchmark to stop
|
||||
/// runaway scripts and timed-out task runs.
|
||||
pub fn kill_tree(pid: u32) {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::process::CommandExt;
|
||||
let _ = Command::new("kill")
|
||||
.arg("-KILL")
|
||||
.arg(format!("-{pid}")) // negative pid = the process group
|
||||
.status();
|
||||
let _ = Command::new("kill").arg("-KILL").arg(pid.to_string()).status();
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let _ = Command::new("taskkill")
|
||||
.args(["/PID", &pid.to_string(), "/T", "/F"])
|
||||
.status();
|
||||
}
|
||||
}
|
||||
|
||||
/// Start a program detached: stdout/stderr are redirected to the agent log
|
||||
/// file. Returns the PID. Fails when the process exits immediately.
|
||||
pub fn spawn_background(
|
||||
|
||||
Reference in New Issue
Block a user