1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-05 01:50:51 +00:00

chore: Add more detailed logging for executing cmds (#1097)

This makes some changes to the logging to make debugging what is
happening a bit easier when we run external commands.
This commit is contained in:
Thomas O'Donnell 2020-04-13 15:22:28 +02:00 committed by GitHub
parent 0ef7df4441
commit 05e323da75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,16 +141,17 @@ pub fn wrap_seq_for_shell(
}
fn internal_exec_cmd(cmd: &str, args: &[&str]) -> Option<CommandOutput> {
log::trace!("Executing command '{:?}' with args '{:?}'", cmd, args);
log::trace!("Executing command {:?} with args {:?}", cmd, args);
match Command::new(cmd).args(args).output() {
Ok(output) => {
let stdout_string = String::from_utf8(output.stdout).unwrap();
let stderr_string = String::from_utf8(output.stderr).unwrap();
log::trace!("stdout: {:?}", stdout_string);
log::trace!("stderr: {:?}", stderr_string);
log::trace!("exit code: \"{:?}\"", output.status.code());
if !output.status.success() {
log::trace!("Non-zero exit code '{:?}'", output.status.code());
log::trace!("stdout: {}", stdout_string);
log::trace!("stderr: {}", stderr_string);
return None;
}