1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 20:17:45 +00:00

Merge pull request #2391 from jhscheer/cmdresult_new

tests/util: add CmdResult::new()
This commit is contained in:
Terts Diepraam 2021-06-11 17:04:24 +02:00 committed by GitHub
commit a8c5ffc024
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,6 +69,22 @@ pub struct CmdResult {
}
impl CmdResult {
pub fn new(
tmpd: Option<Rc<TempDir>>,
code: Option<i32>,
success: bool,
stdout: &[u8],
stderr: &[u8],
) -> CmdResult {
CmdResult {
tmpd,
code,
success,
stdout: stdout.to_vec(),
stderr: stderr.to_vec(),
}
}
/// Returns a reference to the program's standard output as a slice of bytes
pub fn stdout(&self) -> &[u8] {
&self.stdout