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.
|
/// Run the passed command and get the stdout of it.
|
||||||
///
|
///
|
||||||
/// This function does _not_ ensure that stdin is inherited.
|
/// 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 assert = command.assert();
|
||||||
let lines = String::from_utf8(assert.get_output().stdout.clone())
|
let lines = String::from_utf8(assert.get_output().stdout.clone())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -29,15 +29,7 @@ pub fn call(tempdir: &TempDir) -> Vec<String> {
|
||||||
|
|
||||||
// ensure that stdin is not used by the child process
|
// ensure that stdin is not used by the child process
|
||||||
binary.stdin(std::process::Stdio::inherit());
|
binary.stdin(std::process::Stdio::inherit());
|
||||||
|
crate::imag::stdout_of_command(binary)
|
||||||
let assert = binary.assert();
|
|
||||||
let lines = String::from_utf8(assert.get_output().stdout.clone())
|
|
||||||
.unwrap()
|
|
||||||
.lines()
|
|
||||||
.map(String::from)
|
|
||||||
.collect();
|
|
||||||
assert.success();
|
|
||||||
lines
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn binary(tempdir: &TempDir) -> Command {
|
pub fn binary(tempdir: &TempDir) -> Command {
|
||||||
|
|
Loading…
Reference in a new issue