Added output status code to `format_exit_error` for debugging

This commit is contained in:
SpatulaNinja 2017-10-20 00:21:22 -05:00
parent 3c0e254156
commit 4153925599
2 changed files with 6 additions and 4 deletions

View File

@ -77,10 +77,12 @@ fn find_fd_exe() -> PathBuf {
/// Format an error message for when *fd* did not exit successfully. /// Format an error message for when *fd* did not exit successfully.
fn format_exit_error(args: &[&str], output: &process::Output) -> String { fn format_exit_error(args: &[&str], output: &process::Output) -> String {
format!( format!(
"`fd {}` did not exit successfully.\nstdout:\n---\n{}---\nstderr:\n---\n{}---", "`fd {}` did not exit successfully.\nstdout:\n---\n{}---\nstderr:\n---\n{}---\n
code:\n---\n{:?}---\n",
args.join(" "), args.join(" "),
String::from_utf8_lossy(&output.stdout), String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr) String::from_utf8_lossy(&output.stderr),
output.status.code()
) )
} }

View File

@ -550,7 +550,7 @@ fn test_exec() {
Comparing files a.foo and A.FOO Comparing files a.foo and A.FOO
FC: no differences encountered", FC: no differences encountered",
); );
// Test executing 'diff' with the found result and itself. // Test executing 'diff' with the found result and itself.
#[cfg(unix)] te.assert_output(&["--exec", "diff {} {}", "a.foo"],""); #[cfg(unix)] te.assert_output(&["--exec", "diff {} {}", "a.foo"], "");
} }