Mercurial > hg > octave-nkf
diff src/toplev.cc @ 2693:f4d0604cbcc4
[project @ 1997-02-18 15:25:21 by jwe]
author | jwe |
---|---|
date | Tue, 18 Feb 1997 15:25:23 +0000 |
parents | 25fbbe6074e9 |
children | eb2ade3c6609 |
line wrap: on
line diff
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -70,6 +70,7 @@ #include "pt-plot.h" #include "sighandlers.h" #include "sysdep.h" +#include "syswait.h" #include "toplev.h" #include "unwind-prot.h" #include "utils.h" @@ -649,9 +650,13 @@ // Execute a shell command. +static sigset_t signal_set, old_signal_set; + static void cleanup_iprocstream (void *p) { + UNBLOCK_CHILD (old_signal_set); + delete (iprocstream *) p; } @@ -660,6 +665,8 @@ { octave_value_list retval; + BLOCK_CHILD (signal_set, old_signal_set); + iprocstream *cmd = new iprocstream (cmd_str.c_str ()); add_unwind_protect (cleanup_iprocstream, cmd); @@ -680,8 +687,8 @@ // process exited normally, extract the actual exit status of // the command. Otherwise, return 127 as a failure code. - if ((status & 0xff) == 0) - status = (status >> 8) & 0xff; + if (WIFEXITED (status)) + status = WEXITSTATUS (status); output_buf << ends; @@ -787,8 +794,8 @@ // status of the command. Otherwise, return 127 as a // failure code. - if ((status & 0xff) == 0) - status = (status >> 8) & 0xff; + if (WIFEXITED (status)) + status = WEXITSTATUS (status); retval = (double) status; }