diff src/toplev.cc @ 3252:9c784bd18858

[project @ 1999-07-15 00:33:12 by jwe]
author jwe
date Thu, 15 Jul 1999 00:34:05 +0000
parents be8e0ba13644
children 4964d5391acc
line wrap: on
line diff
--- a/src/toplev.cc	Wed Jul 14 22:39:37 1999 +0000
+++ b/src/toplev.cc	Thu Jul 15 00:34:05 1999 +0000
@@ -280,14 +280,6 @@
 
 // Execute a shell command.
 
-static int cmd_status = 0;
-
-static void
-cmd_death_handler (pid_t, int status)
-{
-  cmd_status = status;
-}
-
 static void
 cleanup_iprocstream (void *p)
 {
@@ -305,12 +297,8 @@
 
   iprocstream *cmd = new iprocstream (cmd_str.c_str ());
 
-  cmd_status = -1;
-
   if (cmd)
     {
-      octave_child_list::insert (cmd->pid (), cmd_death_handler);
-
       unwind_protect::add (cleanup_iprocstream, cmd);
 
       if (*cmd)
@@ -344,16 +332,7 @@
 	  while (cmd->get (ch))
 	    output_buf.put (ch);
 
-	  cmd->close ();
-
-	  // One way or another, cmd_death_handler should be called
-	  // when the process exits, and it will save the exit status
-	  // of the command in cmd_status.
-
-	  // The value in cmd_status is as returned by waitpid.  If
-	  // the process exited normally, extract the actual exit
-	  // status of the command.  Otherwise, return 127 as a
-	  // failure code.
+	  int cmd_status = cmd->close ();
 
 	  if (WIFEXITED (cmd_status))
 	    cmd_status = WEXITSTATUS (cmd_status);