diff --git a/tools/codegen/src/file.rs b/tools/codegen/src/file.rs index fee31bc..d904396 100644 --- a/tools/codegen/src/file.rs +++ b/tools/codegen/src/file.rs @@ -149,14 +149,16 @@ pub fn write_raw(function_name: &str, path: &Path, contents: impl AsRef<[u8]>) - } pub fn git_ls_files(dir: &Path, filters: &[&str]) -> Result> { - let output = Command::new("git") - .arg("ls-files") - .args(filters) - .current_dir(dir) - .output() - .with_context(|| format!("failed to run `git ls-files {filters:?}`"))?; + let mut cmd = Command::new("git"); + cmd.arg("ls-files").args(filters).current_dir(dir); + let output = cmd.output().with_context(|| format!("could not execute process `{cmd:?}`"))?; if !output.status.success() { - bail!("failed to run `git ls-files {filters:?}`"); + bail!( + "process didn't exit successfully: `{cmd:?}`:\n\nSTDOUT:\n{0}\n{1}\n{0}\n\nSTDERR:\n{0}\n{2}\n{0}\n", + "-".repeat(60), + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr), + ); } Ok(str::from_utf8(&output.stdout)? .lines()