comparison 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
comparison
equal deleted inserted replaced
12072:33c46d112b05 12073:fe30458b1de8
2031 { return Matrix (1, 2, 0.0); } 2031 { return Matrix (1, 2, 0.0); }
2032 2032
2033 private: 2033 private:
2034 void send_quit (const octave_value& pstream) const 2034 void send_quit (const octave_value& pstream) const
2035 { 2035 {
2036 if (! pstream.is_empty()) 2036 if (! pstream.is_empty ())
2037 { 2037 {
2038 octave_value_list args; 2038 octave_value_list args;
2039 Matrix fids = pstream.matrix_value (); 2039 Matrix fids = pstream.matrix_value ();
2040 2040
2041 if (! error_state) 2041 if (! error_state)
2042 { 2042 {
2043 args(1) = "\nquit;\n"; 2043 args(1) = "\nquit;\n";
2044 args(0) = octave_value (fids (0)); 2044 args(0) = fids(0);
2045 feval ("fputs", args); 2045 feval ("fputs", args);
2046
2046 args.resize (1); 2047 args.resize (1);
2047 feval ("fflush", args); 2048 feval ("fflush", args);
2048 feval ("pclose", args); 2049 feval ("pclose", args);
2050
2049 if (fids.numel () > 1) 2051 if (fids.numel () > 1)
2050 { 2052 {
2051 args(0) = octave_value (fids (1)); 2053 args(0) = fids(1);
2052 feval ("pclose", args); 2054 feval ("pclose", args);
2055
2056 if (fids.numel () > 2)
2057 {
2058 args(0) = fids(2);
2059 feval ("waitpid", args);
2060 }
2053 } 2061 }
2054 } 2062 }
2055 } 2063 }
2056 } 2064 }
2057 }; 2065 };