diff --git a/zebra-test/src/command.rs b/zebra-test/src/command.rs index 27bbf297..fb65ee9c 100644 --- a/zebra-test/src/command.rs +++ b/zebra-test/src/command.rs @@ -160,6 +160,11 @@ pub struct TestChild { impl TestChild { /// Kill the child process. + /// + /// ## BUGS + /// + /// On Windows, this function can return `Ok` for processes that have + /// panicked. See #1781. #[spandoc::spandoc] pub fn kill(&mut self) -> Result<()> { /// SPANDOC: Killing child process @@ -355,6 +360,11 @@ impl TestChild { } /// Is this process currently running? + /// + /// ## BUGS + /// + /// On Windows, this function can return `true` for processes that have + /// panicked. See #1781. pub fn is_running(&mut self) -> bool { matches!(self.child.try_wait(), Ok(None)) } diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index caeb5ada..8791d103 100644 --- a/zebrad/tests/acceptance.rs +++ b/zebrad/tests/acceptance.rs @@ -1229,14 +1229,22 @@ where // In node1 we want to check for the success regex // If there are any errors, we also want to print the node2 output. let output1 = node1.wait_with_output(); + // This mut is only used on cfg(unix), due to #1781. + #[allow(unused_mut)] let (output1, mut node2) = node2.kill_on_error(output1)?; - // node2 should have panicked due to a conflict. Kill it here - // anyway, so it doesn't outlive the test on error. + // node2 should have panicked due to a conflict. Kill it here anyway, so it + // doesn't outlive the test on error. + // + // This code doesn't work on Windows. It's cleanup code that only runs when + // node2 doesn't panic as expected. So it's ok to skip it. See #1781. + #[cfg(unix)] if node2.is_running() { use color_eyre::eyre::eyre; return node2 - .kill_on_error::<(), _>(Err(eyre!("conflicted node2 did not panic"))) + .kill_on_error::<(), _>(Err(eyre!( + "conflicted node2 was still running, but the test expected a panic" + ))) .context_from(&output1) .map(|_| ()); }