summaryrefslogtreecommitdiff
path: root/test_util/src/lib.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-06-29 17:04:19 -0400
committerGitHub <noreply@github.com>2020-06-29 17:04:19 -0400
commita19d6a2613b65771748cee97c620c04a62e8a6e4 (patch)
tree2495b60c395f9be62553cc3d5c64b50688570634 /test_util/src/lib.rs
parentf5242f333ec8ba3c1f4bea88a5b4c55bb14dbfb7 (diff)
ignore PoisonError in test_server (#6567)
Diffstat (limited to 'test_util/src/lib.rs')
-rw-r--r--test_util/src/lib.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs
index 86b43ec36..f63ed71a7 100644
--- a/test_util/src/lib.rs
+++ b/test_util/src/lib.rs
@@ -78,7 +78,13 @@ impl<'a> Drop for HttpServerGuard<'a> {
/// will be killed.
pub fn http_server<'a>() -> HttpServerGuard<'a> {
// TODO(bartlomieju) Allow tests to use the http server in parallel.
- let g = GUARD.lock().unwrap();
+ let r = GUARD.lock();
+ let g = if let Err(poison_err) = r {
+ // If panics happened, ignore it. This is for tests.
+ poison_err.into_inner()
+ } else {
+ r.unwrap()
+ };
println!("tools/http_server.py starting...");
let mut child = Command::new("python")