Skip to content

Commit

Permalink
loggedcmd: Align with version in rsrepo
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Jan 2, 2025
1 parent 2037b71 commit 4062eea
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/loggedcmd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ impl LoggedCommand {
pub fn new<S: AsRef<OsStr>>(arg0: S) -> Self {
let arg0 = arg0.as_ref();
LoggedCommand {
cmdline: shell_words::quote(&arg0.to_string_lossy()).to_string(),
cmdline: quote_osstr(arg0),

Check warning on line 16 in crates/loggedcmd/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

crates/loggedcmd/src/lib.rs#L16

Added line #L16 was not covered by tests
cmd: Command::new(arg0),
}
}

pub fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self {
let arg = arg.as_ref();
self.cmdline.push(' ');
self.cmdline
.push_str(&shell_words::quote(&arg.to_string_lossy()));
self.cmdline.push_str(&quote_osstr(arg));

Check warning on line 24 in crates/loggedcmd/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

crates/loggedcmd/src/lib.rs#L24

Added line #L24 was not covered by tests
self.cmd.arg(arg);
self
}
Expand Down Expand Up @@ -107,3 +106,7 @@ pub enum CommandOutputError {
source: std::str::Utf8Error,
},
}

fn quote_osstr(s: &OsStr) -> String {
shell_words::quote(&s.to_string_lossy()).to_string()
}

Check warning on line 112 in crates/loggedcmd/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

crates/loggedcmd/src/lib.rs#L110-L112

Added lines #L110 - L112 were not covered by tests

0 comments on commit 4062eea

Please sign in to comment.