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.
This commit is contained in:
Přemysl Eric Janouch 2020-09-28 20:04:52 +02:00
parent 98c8dc5b7d
commit 121d7850fe
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 6 additions and 0 deletions

View File

@ -865,6 +865,12 @@ fun run_program (initializer_list<const char*> list, const string &filename) {
if (WSTOPSIG (status) == SIGTSTP) if (WSTOPSIG (status) == SIGTSTP)
kill (child, SIGCONT); kill (child, SIGCONT);
tcsetpgrp (STDOUT_FILENO, getpgid (0)); 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 (); refresh ();