Skip to content

Commit

Permalink
cmd: Note trailing newlines are trimmed
Browse files Browse the repository at this point in the history
This is very important and useful behavior, and worth documenting.
  • Loading branch information
cgwalters authored Jun 7, 2024
1 parent c300b94 commit d8adc22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,12 +966,12 @@ impl<'a> Cmd<'a> {
self.output_impl(false, false).map(|_| ())
}

/// Run the command and return its stdout as a string.
/// Run the command and return its stdout as a string. Any trailing newline or carriage return will be trimmed.
pub fn read(&self) -> Result<String> {
self.read_stream(false)
}

/// Run the command and return its stderr as a string.
/// Run the command and return its stderr as a string. Any trailing newline or carriage return will be trimmed.
pub fn read_stderr(&self) -> Result<String> {
self.read_stream(true)
}
Expand Down

0 comments on commit d8adc22

Please sign in to comment.