From 433954d55c8702005bd07af27d8c2fdc9f9a6df9 Mon Sep 17 00:00:00 2001 From: laniakea64 Date: Wed, 11 Dec 2024 12:41:33 -0500 Subject: [PATCH] tests: address Rust/Clippy 1.83 `clippy::zombie_processes` warning --- tests/src/common.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/src/common.rs b/tests/src/common.rs index 5c2c6bd..940bf00 100644 --- a/tests/src/common.rs +++ b/tests/src/common.rs @@ -84,7 +84,17 @@ pub fn run_vim( let mut vim_stdin = vim.stdin.take().unwrap(); // Prevent stalling on "Press ENTER or type command to continue" - vim_stdin.write_all(b"\r")?; + if let Err(e) = vim_stdin.write_all(b"\r") { + // If we return this error, the Vim process will never be waited on in the error case, + // resulting in `clippy::zombie_processes` lint flagging the above call to `.spawn()`. + // To avoid stray processes, don't return this error, try to terminate the Vim process + // but unconditionally fall through to the .wait_timeout() below + // so that the Vim process is always waited on. + eprintln!("Error writing to subprocess stdin: {}", e); + if let Err(e) = vim.kill() { + eprintln!("Error sending signal to subprocess: {}", e); + } + } let status = loop { let poll_interval = Duration::from_millis(200);