diff src/graphics.cc @ 12073:fe30458b1de8 release-3-2-x

try to avoid gnuplot zombies
author John W. Eaton <jwe@octave.org>
date Wed, 26 Aug 2009 08:17:08 +0200
parents 1d4212b80713
children
line wrap: on
line diff
--- a/src/graphics.cc	Tue Aug 25 10:26:01 2009 +0200
+++ b/src/graphics.cc	Wed Aug 26 08:17:08 2009 +0200
@@ -2033,7 +2033,7 @@
 private:
   void send_quit (const octave_value& pstream) const
     {
-      if (! pstream.is_empty())
+      if (! pstream.is_empty ())
 	{
 	  octave_value_list args;
 	  Matrix fids = pstream.matrix_value ();
@@ -2041,15 +2041,23 @@
 	  if (! error_state)
 	    {
 	      args(1) = "\nquit;\n";
-	      args(0) = octave_value (fids (0));
+	      args(0) = fids(0);
 	      feval ("fputs", args);
+
 	      args.resize (1);
 	      feval ("fflush", args);
 	      feval ("pclose", args);
+
 	      if (fids.numel () > 1)
 		{
-		  args(0) = octave_value (fids (1));
+		  args(0) = fids(1);
 		  feval ("pclose", args);
+
+		  if (fids.numel () > 2)
+		    {
+		      args(0) = fids(2);
+		      feval ("waitpid", args);
+		    }
 		}
 	    }
 	}