pub struct CommandOutput {
pub stdout: Vec<u8>,
pub stderr: String,
pub exit_code: i32,
pub success: bool,
}Expand description
Captured output from running a git command.
Fields§
§stdout: Vec<u8>Captured stdout as raw bytes.
git output is not guaranteed to be valid UTF-8 — cat-file on a binary
blob, paths under unusual encodings, and -z/NUL-delimited formats all
produce bytes that lossy decoding would corrupt. The bytes are preserved
verbatim; use stdout_str for a lossy text view or
stdout_bytes for the raw slice.
stderr: StringCaptured stderr, decoded lossily as UTF-8 (git diagnostics are text).
exit_code: i32Exit code (-1 if the process was terminated by a signal).
success: boolWhether the process exited with status 0.
Implementations§
Source§impl CommandOutput
impl CommandOutput
Sourcepub fn stdout_bytes(&self) -> &[u8] ⓘ
pub fn stdout_bytes(&self) -> &[u8] ⓘ
stdout as a raw byte slice. Use this for binary or non-UTF-8 output.
Sourcepub fn stdout_str(&self) -> Cow<'_, str>
pub fn stdout_str(&self) -> Cow<'_, str>
stdout decoded as UTF-8, lossily (invalid sequences become U+FFFD).
Sourcepub fn stdout_lines(&self) -> Vec<String>
pub fn stdout_lines(&self) -> Vec<String>
stdout decoded lossily and split into lines.
Sourcepub fn stderr_lines(&self) -> Vec<&str>
pub fn stderr_lines(&self) -> Vec<&str>
stderr split into lines.
Sourcepub fn stdout_trimmed(&self) -> String
pub fn stdout_trimmed(&self) -> String
stdout decoded lossily with trailing whitespace trimmed.
Trait Implementations§
Source§impl Clone for CommandOutput
impl Clone for CommandOutput
Source§fn clone(&self) -> CommandOutput
fn clone(&self) -> CommandOutput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more