Skip to content

Commit 921e2f8

Browse files
committed
run_make_support: allow obtaining raw stdout/stderr
And match `stdout/stderr` lossy UTF-8 helpers.
1 parent f225713 commit 921e2f8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: src/tools/run-make-support/src/command.rs

+18
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ pub struct CompletedProcess {
222222
}
223223

224224
impl CompletedProcess {
225+
#[must_use]
226+
#[track_caller]
227+
pub fn stdout(&self) -> Vec<u8> {
228+
self.output.stdout.clone()
229+
}
230+
225231
#[must_use]
226232
#[track_caller]
227233
pub fn stdout_utf8(&self) -> String {
@@ -234,12 +240,24 @@ impl CompletedProcess {
234240
String::from_utf8_lossy(&self.output.stdout.clone()).to_string()
235241
}
236242

243+
#[must_use]
244+
#[track_caller]
245+
pub fn stderr(&self) -> Vec<u8> {
246+
self.output.stderr.clone()
247+
}
248+
237249
#[must_use]
238250
#[track_caller]
239251
pub fn stderr_utf8(&self) -> String {
240252
String::from_utf8(self.output.stderr.clone()).expect("stderr is not valid UTF-8")
241253
}
242254

255+
#[must_use]
256+
#[track_caller]
257+
pub fn invalid_stderr_utf8(&self) -> String {
258+
String::from_utf8_lossy(&self.output.stderr.clone()).to_string()
259+
}
260+
243261
#[must_use]
244262
pub fn status(&self) -> ExitStatus {
245263
self.output.status

0 commit comments

Comments
 (0)