Refactor out helper function to simply get stdout of a command

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-10-20 12:25:13 +02:00
parent fd2afad72a
commit a8b75ad2ba
2 changed files with 2 additions and 10 deletions

View file

@ -42,7 +42,7 @@ pub fn binary(tempdir: &TempDir, binary_name: &str) -> Command {
/// Run the passed command and get the stdout of it.
///
/// This function does _not_ ensure that stdin is inherited.
pub fn stdout_of_command(command: Command) -> Vec<String> {
pub fn stdout_of_command(mut command: Command) -> Vec<String> {
let assert = command.assert();
let lines = String::from_utf8(assert.get_output().stdout.clone())
.unwrap()

View file

@ -29,15 +29,7 @@ pub fn call(tempdir: &TempDir) -> Vec<String> {
// ensure that stdin is not used by the child process
binary.stdin(std::process::Stdio::inherit());
let assert = binary.assert();
let lines = String::from_utf8(assert.get_output().stdout.clone())
.unwrap()
.lines()
.map(String::from)
.collect();
assert.success();
lines
crate::imag::stdout_of_command(binary)
}
pub fn binary(tempdir: &TempDir) -> Command {