Re: use execute module in m4

Bruno Haible <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
Hi Eric,

> the execute module outputs an unwanted warning message when a signal
> is encountered in the child; m4 would rather handle the warning itself to
> give it consistent formatting.  OK to apply the gnulib patch?

Makes sense indeed to leave to the caller error messages which the caller
can do. Applied as below.


2009-03-01  Eric Blake  <[email protected]>
            Bruno Haible  <[email protected]>

	* lib/wait-process.h (wait_subprocess): Describe effect of termsigp on
	error messages.
	* lib/wait-process.c (wait_subprocess): Omit error message about
	deadly signal sent to the child of termsigp != NULL.

--- lib/wait-process.h.orig	2009-03-01 18:11:48.000000000 +0100
+++ lib/wait-process.h	2009-03-01 18:08:55.000000000 +0100
@@ -48,9 +48,10 @@
      slave process.
    - If exit_on_error is true, any error will cause the main process to exit
      with an error status.
-   - If termsigp is not NULL, *termsig will be set to the signal that
+   - If termsigp is not NULL: *termsig will be set to the signal that
      terminated the subprocess (if supported by the platform: not on native
-     Windows platforms), otherwise 0.
+     Windows platforms), otherwise 0, and the error message about the signal
+     that terminated the subprocess will be omitted.
    Prerequisites: The signal handler for SIGCHLD should not be set to SIG_IGN,
    otherwise this function will not work.  */
 extern int wait_subprocess (pid_t child, const char *progname,
--- lib/wait-process.c.orig	2009-03-01 18:11:48.000000000 +0100
+++ lib/wait-process.c	2009-03-01 18:09:48.000000000 +0100
@@ -269,7 +269,7 @@
       if (info.si_status == SIGPIPE && ignore_sigpipe)
 	return 0;
 # endif
-      if (exit_on_error || !null_stderr)
+      if (exit_on_error || (!null_stderr && termsigp == NULL))
 	error (exit_on_error ? EXIT_FAILURE : 0, 0,
 	       _("%s subprocess got fatal signal %d"),
 	       progname, info.si_status);
@@ -341,7 +341,7 @@
       if (WTERMSIG (status) == SIGPIPE && ignore_sigpipe)
 	return 0;
 # endif
-      if (exit_on_error || !null_stderr)
+      if (exit_on_error || (!null_stderr && termsigp == NULL))
 	error (exit_on_error ? EXIT_FAILURE : 0, 0,
 	       _("%s subprocess got fatal signal %d"),
 	       progname, (int) WTERMSIG (status));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.