Skip to content

Commit cd5ae33

Browse files
authored
Fix detect_family deadlock
Fixed #1623 Due to child blocking on stderr writing and detect_family blocking on child stdout reading
1 parent 3ee6682 commit cd5ae33

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/tool.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,9 @@ impl Tool {
224224
let mut captured_cargo_output = compiler_detect_output.clone();
225225
captured_cargo_output.output = OutputKind::Capture;
226226
captured_cargo_output.warnings = true;
227-
let mut child = spawn(&mut cmd, &captured_cargo_output)?;
227+
let Output { status, stdout, stderr } = spawn(&mut cmd, &captured_cargo_output)?.wait_with_output()?;
228228

229-
let mut out = vec![];
230-
let mut err = vec![];
231-
child.stdout.take().unwrap().read_to_end(&mut out)?;
232-
child.stderr.take().unwrap().read_to_end(&mut err)?;
233-
234-
let status = child.wait()?;
235-
236-
let stdout = if [&out, &err]
229+
let stdout = if [&stdout, &stderr]
237230
.iter()
238231
.any(|o| String::from_utf8_lossy(o).contains("-Wslash-u-filename"))
239232
{

0 commit comments

Comments
 (0)