Skip to content

Commit

Permalink
tests: address Rust/Clippy 1.83 clippy::zombie_processes warning
Browse files Browse the repository at this point in the history
  • Loading branch information
laniakea64 committed Dec 11, 2024
1 parent 945d0b7 commit 433954d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 433954d

Please sign in to comment.