summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel McCarney <daniel@binaryparadox.net>2024-09-27 10:31:39 -0400
committerDaniel McCarney <daniel@binaryparadox.net>2024-09-27 12:08:44 -0400
commitc6d5b7e92d365c657e89b4b6b849aeaab23a17a2 (patch)
tree7276c43abed924bf6f5eb61f3f7db0ec7df3b5a1
parentc73b2e1333ed002ebda283bc20c203ca70356b71 (diff)
tests: fix clippy::zombie_processes finding
Nightly clippy's `clippy::zombie_processes` lint flagged the following: ``` error: spawned process is never `wait()`ed on --> tests/client_server.rs:285:26 | 285 | let mut server = self.server_opts.run_server(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: consider calling `.wait()` = note: not doing so might leave behind zombie processes = note: see https://doc.rust-lang.org/stable/std/process/struct.Child.html#warning = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zombie_processes ``` While we _do_ call `kill()` on the process, we weren't `wait()`ing it. The `Process::Child` docs have a warning: On some systems, calling wait or similar is necessary for the OS to release resources. A process that terminated but has not been waited on is still around as a “zombie”. Leaving too many zombies around may exhaust global resources (for example process IDs). So it seems it may not be sufficient on all systems to `kill()` without `wait()`. Let's add a `wait()` just to be sure. Nobody likes zombies.
-rw-r--r--tests/client_server.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/client_server.rs b/tests/client_server.rs
index f794240..1f3d2a3 100644
--- a/tests/client_server.rs
+++ b/tests/client_server.rs
@@ -292,6 +292,7 @@ impl TestCase {
});
server.kill().expect("failed to kill server");
+ server.wait().expect("failed to wait on server");
result
}
}