mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-08-14 15:23:19 +00:00
system report: record stderr output too
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
c55884d1a7
commit
122179414c
@ -154,10 +154,20 @@ fn get_command_output(exe: &str, args: &Vec<&str>) -> String {
|
|||||||
.args(args)
|
.args(args)
|
||||||
.output();
|
.output();
|
||||||
let output = match output {
|
let output = match output {
|
||||||
Ok(output) => String::from_utf8_lossy(&output.stdout).to_string(),
|
Ok(output) => {
|
||||||
|
let mut out = String::from_utf8_lossy(&output.stdout)
|
||||||
|
.trim_end()
|
||||||
|
.to_string();
|
||||||
|
let stderr = String::from_utf8_lossy(&output.stderr)
|
||||||
|
.trim_end()
|
||||||
|
.to_string();
|
||||||
|
if !stderr.is_empty() {
|
||||||
|
writeln!(out, "\n```\nSTDERR:\n```\n{stderr}");
|
||||||
|
}
|
||||||
|
out
|
||||||
|
}
|
||||||
Err(err) => err.to_string(),
|
Err(err) => err.to_string(),
|
||||||
};
|
};
|
||||||
let output = output.trim_end();
|
|
||||||
format!("$ `{exe} {}`\n```\n{output}\n```", args.join(" "))
|
format!("$ `{exe} {}`\n```\n{output}\n```", args.join(" "))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user