summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-09-28 20:04:52 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-09-28 20:05:29 +0200
commit121d7850fead25bc0cb2dd14b11d7db29d0498ee (patch)
tree82b1dfa505e4dcd772e5cfb522419dfb830a2eb4
parent98c8dc5b7d43892cfb0d5d4c1ec5eca0ed7ffd49 (diff)
downloadsdn-121d7850fead25bc0cb2dd14b11d7db29d0498ee.tar.gz
sdn-121d7850fead25bc0cb2dd14b11d7db29d0498ee.tar.xz
sdn-121d7850fead25bc0cb2dd14b11d7db29d0498ee.zip
Show error output from failed helpers
Usually, when the pager or the editor fail and return a non-zero exit status, they display a message on the standard error output. We might also try to redirect this output to show_mesage() but it might not fit as a whole, so, given the relative rareness of this situation, this slight inconsistency shouldn't be much of an issue. It'd also be possible to redirect the output to run_pager() but in doing so, we might make the problem recursive.
-rw-r--r--sdn.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/sdn.cpp b/sdn.cpp
index b9d18c4..37caf19 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -865,6 +865,12 @@ fun run_program (initializer_list<const char*> list, const string &filename) {
if (WSTOPSIG (status) == SIGTSTP)
kill (child, SIGCONT);
tcsetpgrp (STDOUT_FILENO, getpgid (0));
+
+ if (WIFEXITED (status) && WEXITSTATUS (status)) {
+ printf ("Helper returned non-zero exit status %d. "
+ "Press Enter to continue.\n", WEXITSTATUS (status));
+ string dummy; getline (cin, dummy);
+ }
}
refresh ();