Mercurial > hg > octave-lyh > gnulib-hg
changeset 4927:bc5f62830252
Update from gettext.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 20 Jan 2004 16:47:31 +0000 |
parents | 4132e2ba0a9c |
children | 6904dd9a5ccf |
files | lib/ChangeLog lib/wait-process.c lib/wait-process.h |
diffstat | 3 files changed, 50 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,20 @@ +2003-12-28 Bruno Haible <bruno@clisp.org> + + * wait-process.c (wait_subprocess): Add ignore_sigpipe argument. + * wait-process.c (wait_subprocess): Likewise. Handle SIGPIPE specially. + +2003-11-28 Bruno Haible <bruno@clisp.org> + + * wait-process.c (cleanup_slaves): Use ANSI C declaration. + +2003-11-27 Bruno Haible <bruno@clisp.org> + + * wait-process.c: On Windows, include windows.h. Needed on mingw. + +2003-11-17 Bruno Haible <bruno@clisp.org> + + * wait-process.c (wait_process): Disable the 2003-10-31 waitid() patch. + 2003-11-24 Bruno Haible <bruno@clisp.org> * xallocsa.h: New file, from GNU gettext.
--- a/lib/wait-process.c +++ b/lib/wait-process.c @@ -103,6 +103,9 @@ #if defined _MSC_VER || defined __MINGW32__ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + /* The return value of spawnvp() is really a process handle as returned by CreateProcess(). Therefore we can kill it using TerminateProcess. */ #define kill(pid,sig) TerminateProcess ((HANDLE) (pid), sig) @@ -140,7 +143,7 @@ /* The cleanup action. It gets called asynchronously. */ static void -cleanup_slaves () +cleanup_slaves (void) { for (;;) { @@ -249,10 +252,13 @@ return 127. */ int wait_subprocess (pid_t child, const char *progname, - bool null_stderr, + bool ignore_sigpipe, bool null_stderr, bool slave_process, bool exit_on_error) { -#if HAVE_WAITID && defined WNOWAIT +#if HAVE_WAITID && defined WNOWAIT && 0 + /* Commented out because waitid() with WNOWAIT doesn't work: On Solaris 7 + and OSF/1 4.0, it returns -1 and sets errno = ECHILD, and on HP-UX 10.20 + it just hangs. */ /* Use of waitid() with WNOWAIT avoids a race condition: If slave_process is true, and this process sleeps a very long time between the return from waitpid() and the execution of unregister_slave_subprocess(), and @@ -313,6 +319,10 @@ { case CLD_KILLED: case CLD_DUMPED: +# ifdef SIGPIPE + if (info.si_status == SIGPIPE && ignore_sigpipe) + return 0; +# endif if (exit_on_error || !null_stderr) error (exit_on_error ? EXIT_FAILURE : 0, 0, _("%s subprocess got fatal signal %d"), @@ -376,6 +386,10 @@ if (WIFSIGNALED (status)) { +# ifdef SIGPIPE + if (WTERMSIG (status) == SIGPIPE && ignore_sigpipe) + return 0; +# endif if (exit_on_error || !null_stderr) error (exit_on_error ? EXIT_FAILURE : 0, 0, _("%s subprocess got fatal signal %d"),
--- a/lib/wait-process.h +++ b/lib/wait-process.h @@ -36,9 +36,23 @@ /* Wait for a subprocess to finish. Return its exit code. If it didn't terminate correctly, exit if exit_on_error is true, otherwise - return 127. */ + return 127. + Arguments: + - child is the pid of the subprocess. + - progname is the name of the program executed by the subprocess, used for + error messages. + - If ignore_sigpipe is true, consider a subprocess termination due to + SIGPIPE as equivalent to a success. This is suitable for processes whose + only purpose is to write to standard output. This flag can be safely set + to false when the process' standard output is known to go to DEV_NULL. + - If null_stderr is true, the usual error message to stderr will be omitted. + This is suitable when the subprocess does not fulfill an important task. + - slave_process should be set to true if the process has been launched as a + slave process. + - If exit_on_error is true, any error will cause the main process to exit + with an error status. */ extern int wait_subprocess (pid_t child, const char *progname, - bool null_stderr, + bool ignore_sigpipe, bool null_stderr, bool slave_process, bool exit_on_error); /* Register a subprocess as being a slave process. This means that the