From dc9188dffc8e5d3ae712e4da629befd6f673ae93 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 11 Oct 2023 17:22:01 -0400 Subject: [PATCH] Better error logging when emacs errors out. --- src/compare/parse.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/compare/parse.rs b/src/compare/parse.rs index 3b6e0a3..10cb01d 100644 --- a/src/compare/parse.rs +++ b/src/compare/parse.rs @@ -55,7 +55,16 @@ where .arg("--eval") .arg(elisp_script); let out = cmd.output()?; - out.status.exit_ok()?; + let status = out.status.exit_ok(); + if status.is_err() { + eprintln!( + "Emacs errored out: {}\n{}", + String::from_utf8(out.stdout)?, + String::from_utf8(out.stderr)? + ); + status?; + unreachable!(); + } let org_sexp = out.stderr; Ok(String::from_utf8(org_sexp)?) } @@ -98,7 +107,16 @@ where .arg("--eval") .arg(elisp_script); let out = cmd.output()?; - out.status.exit_ok()?; + let status = out.status.exit_ok(); + if status.is_err() { + eprintln!( + "Emacs errored out: {}\n{}", + String::from_utf8(out.stdout)?, + String::from_utf8(out.stderr)? + ); + status?; + unreachable!(); + } let org_sexp = out.stderr; Ok(String::from_utf8(org_sexp)?) }