[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 03/04: [pre-grohtml]: Fix Savannah #60782.
From: |
G. Branden Robinson |
Subject: |
[groff] 03/04: [pre-grohtml]: Fix Savannah #60782. |
Date: |
Mon, 27 Jun 2022 16:49:43 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 11137209eded488c5ecb598e13bd9450f004dd49
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Jun 27 10:34:32 2022 -0500
[pre-grohtml]: Fix Savannah #60782.
* src/preproc/html/pre-html.cpp (char_buffer::run_output_filter): Return
wait status of child process.
(char_buffer::run_output_filter, main): Rename local variable `status`
to `wstatus` to recognize distinction between exit status (a 7-bit
quantity) and wait status (a wider type).
(main): Issue fatal diagnostic if child process exited with nonzero
status. Since the child's output to the standard error stream is
lost, advise re-running with different output driver to see them.
This unhappy shortcoming is filed as Savannah #62673. Explicitly
return zero otherwise.
Fixes <https://savannah.gnu.org/bugs/?60782>.
---
ChangeLog | 16 ++++++++++++++++
src/preproc/html/pre-html.cpp | 21 +++++++++++++--------
2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bffe5d5b..d20a86e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2022-06-27 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/preproc/html/pre-html.cpp
+ (char_buffer::run_output_filter): Return wait status of child
+ process.
+ (char_buffer::run_output_filter, main): Rename local variable
+ `status` to `wstatus` to recognize distinction between exit
+ status (a 7-bit quantity) and wait status (a wider type).
+ (main): Issue fatal diagnostic if child process exited with
+ nonzero status. Since the child's output to the standard error
+ stream is lost, advise re-running with different output driver
+ to see them. This unhappy shortcoming is filed as Savannah
+ #62673. Explicitly return zero otherwise.
+
+ Fixes <https://savannah.gnu.org/bugs/?60782>.
+
2022-06-22 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/groff/tests/ab_works.sh: Add regression test for
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 50ca4953..f15747f3 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -1344,7 +1344,7 @@ int char_buffer::run_output_filter(int filter, int argc,
char **argv)
{
int pipedes[2];
PID_T child_pid;
- int status;
+ int wstatus;
print_args(argc, argv);
if (pipe(pipedes) < 0)
@@ -1412,7 +1412,7 @@ int char_buffer::run_output_filter(int filter, int argc,
char **argv)
// Finally, we must wait for the child process to complete.
- if (WAIT(&status, child_pid, _WAIT_CHILD) != child_pid)
+ if (WAIT(&wstatus, child_pid, _WAIT_CHILD) != child_pid)
sys_fatal("wait");
}
@@ -1479,7 +1479,7 @@ int char_buffer::run_output_filter(int filter, int argc,
char **argv)
// And finally, we must wait for the child process to complete.
- if (WAIT(&status, child_pid, _WAIT_CHILD) != child_pid)
+ if (WAIT(&wstatus, child_pid, _WAIT_CHILD) != child_pid)
sys_fatal("wait");
#else /* can't do asynchronous pipes! */
@@ -1489,7 +1489,7 @@ int char_buffer::run_output_filter(int filter, int argc,
char **argv)
#endif /* MAY_FORK_CHILD_PROCESS or MAY_SPAWN_ASYNCHRONOUS_CHILD */
- return 0;
+ return wstatus;
}
/*
@@ -1855,12 +1855,17 @@ int main(int argc, char **argv)
do_file("-");
if (makeTempFiles())
return 1;
- ok = inputFile.do_image(argc, argv);
- if (ok == 0) {
+ int wstatus = inputFile.do_image(argc, argv);
+ if (wstatus == 0) {
generateImages(regionFileName);
- ok = inputFile.do_html(argc, argv);
+ wstatus = inputFile.do_html(argc, argv);
}
- return ok;
+ else
+ if (WEXITSTATUS(wstatus) != 0)
+ fatal("'%1' exited with status %2; re-run '%1' with a different"
+ " output driver to see diagnostic messages", argv[0],
+ WEXITSTATUS(wstatus));
+ return 0;
}
static int do_file(const char *filename)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 03/04: [pre-grohtml]: Fix Savannah #60782.,
G. Branden Robinson <=