From 90da89bdca15cd512d096b781b085e0563222da9 Mon Sep 17 00:00:00 2001 From: Arlo Siemsen Date: Mon, 10 Oct 2022 10:43:39 -0500 Subject: [PATCH] Fix deadlock when build scripts are waiting for input on stdin --- crates/cargo-util/src/process_builder.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/cargo-util/src/process_builder.rs b/crates/cargo-util/src/process_builder.rs index 714cc595eff4..43ef5debb97e 100644 --- a/crates/cargo-util/src/process_builder.rs +++ b/crates/cargo-util/src/process_builder.rs @@ -355,6 +355,8 @@ impl ProcessBuilder { let (mut child, argfile) = spawn(cmd)?; let out = child.stdout.take().unwrap(); let err = child.stderr.take().unwrap(); + // close stdin to prevent deadlock + drop(child.stdin.take().unwrap()); read2(out, err, &mut |is_out, data, eof| { let pos = if is_out { &mut stdout_pos