Kill the daemon serving `socket` (the D4 test's auto-started daemon is detached; it must not outlive the test).
(socket: &Path)
| 153 | /// Kill the daemon serving `socket` (the D4 test's auto-started daemon is |
| 154 | /// detached; it must not outlive the test). |
| 155 | fn 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 | |
| 166 | impl Drop for SocketEnv { |
| 167 | fn drop(&mut self) { |
no test coverage detected