Refactor out helper function to simply get stdout of a command
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
fd2afad72a
commit
a8b75ad2ba
2 changed files with 2 additions and 10 deletions
|
@ -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()
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue