From 10097e446745e8d443fc28323b7e58ae3e8167cf Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Wed, 1 Sep 2021 05:48:06 +0000 Subject: Refactor test code and CI --- tests/util/mod.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/util/mod.rs b/tests/util/mod.rs index cd29b28..c965ffd 100644 --- a/tests/util/mod.rs +++ b/tests/util/mod.rs @@ -44,16 +44,20 @@ impl Hdwallet { self.command.stdin(Stdio::piped()); } - let mut process = self.command.spawn().map_err(|err| err.to_string())?; + let mut process = self.command.spawn().unwrap(); - if let Some(data) = self.stdin { + let input = self.stdin.map(|data| { let mut stdin = process.stdin.take().unwrap(); thread::spawn(move || { stdin.write_all(&data).unwrap(); - }); + }) + }); + + let output = process.wait_with_output().unwrap(); + if let Some(input) = input { + input.join().unwrap(); } - let output = process.wait_with_output().map_err(|err| err.to_string())?; if output.status.success() { Ok(string_from_utf8(output.stdout)) } else { -- cgit v1.2.3