Skip to content

Commit c6d5b7e

Browse files
committed
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.
1 parent c73b2e1 commit c6d5b7e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/client_server.rs

+1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ impl TestCase {
292292
});
293293

294294
server.kill().expect("failed to kill server");
295+
server.wait().expect("failed to wait on server");
295296
result
296297
}
297298
}

0 commit comments

Comments
 (0)