MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / kill_daemon_on

Function kill_daemon_on

atomic-cli/tests/provenance_rpc_sink.rs:155–164  ·  view source on GitHub ↗

Kill the daemon serving `socket` (the D4 test's auto-started daemon is detached; it must not outlive the test).

(socket: &Path)

Source from the content-addressed store, hash-verified

153/// Kill the daemon serving `socket` (the D4 test's auto-started daemon is
154/// detached; it must not outlive the test).
155fn kill_daemon_on(socket: &Path) {
156 let output = Command::new("lsof").arg("-t").arg(socket).output();
157 if let Ok(out) = output {
158 for line in String::from_utf8_lossy(&out.stdout).lines() {
159 if let Ok(pid) = line.trim().parse::<i32>() {
160 let _ = Command::new("kill").arg("-9").arg(pid.to_string()).output();
161 }
162 }
163 }
164}
165
166impl Drop for SocketEnv {
167 fn drop(&mut self) {

Calls 2

outputMethod · 0.45
linesMethod · 0.45

Tested by

no test coverage detected