Move Stdio extraction to enum

This commit is contained in:
David Peter authored and David Peter committed 2022-02-22 13:24:05 +01:00
1 parent e1da8ba00f
commit 9b8f2a9ee2
2 files changed
+12 -6

No files matched your search

+10 -1
View File
@@ -1,4 +1,4 @@
use std::process::Command;
use std::process::{Command, Stdio};
use std::{cmp, fmt};
use anyhow::ensure;
@@ -124,6 +124,15 @@ impl Default for CommandOutputPolicy {
}
}
impl CommandOutputPolicy {
pub fn get_stdout_stderr(&self) -> (Stdio, Stdio) {
match self {
CommandOutputPolicy::Discard => (Stdio::null(), Stdio::null()),
CommandOutputPolicy::Forward => (Stdio::inherit(), Stdio::inherit()),
}
}
}
pub enum ExecutorKind {
Shell(Shell),
Mock(Option<String>),