diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/util/mod.rs | 12 |
1 files changed, 8 insertions, 4 deletions
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 { |
