mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
run_make_support: allow obtaining raw stdout/stderr
And match `stdout/stderr` lossy UTF-8 helpers.
This commit is contained in:
parent
f225713007
commit
921e2f8f66
@ -222,6 +222,12 @@ pub struct CompletedProcess {
|
||||
}
|
||||
|
||||
impl CompletedProcess {
|
||||
#[must_use]
|
||||
#[track_caller]
|
||||
pub fn stdout(&self) -> Vec<u8> {
|
||||
self.output.stdout.clone()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[track_caller]
|
||||
pub fn stdout_utf8(&self) -> String {
|
||||
@ -234,12 +240,24 @@ impl CompletedProcess {
|
||||
String::from_utf8_lossy(&self.output.stdout.clone()).to_string()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[track_caller]
|
||||
pub fn stderr(&self) -> Vec<u8> {
|
||||
self.output.stderr.clone()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[track_caller]
|
||||
pub fn stderr_utf8(&self) -> String {
|
||||
String::from_utf8(self.output.stderr.clone()).expect("stderr is not valid UTF-8")
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[track_caller]
|
||||
pub fn invalid_stderr_utf8(&self) -> String {
|
||||
String::from_utf8_lossy(&self.output.stderr.clone()).to_string()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn status(&self) -> ExitStatus {
|
||||
self.output.status
|
||||
|
Loading…
Reference in New Issue
Block a user