help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can popen2 be avoided?


From: John W. Eaton
Subject: Can popen2 be avoided?
Date: Wed, 6 Sep 2000 23:45:41 -0500 (CDT)

On  6-Sep-2000, Stef Pillaert (KAHO) <address@hidden> wrote:

| I have trouble using popen-close (see bug-octave 2000-276) and popen2( see
| help-octave 2000-722).
| For my students, I'm making some simulations, where the calculations are
| done in octave, but the interface is in Tcl/Tk.
| 
| The interface (which I start with popen from octave), is perfectly able to
| send strings to octave, but I would like the output of octave to be shown in
| the same interface, not to stdout. Since I can't get popen2 to work, is
| there another way to send the output of octave to the interface? I'm not
| very familiar with communicating between processes (as you might have
| noticed...), so...can someone help me?

There have been some problems with popen2.  I think the current CVS
sources fix all but one of the problems, which is that it is possible
for nothing to be available to read from the subprocess (popen2 sets
that file descriptor up for non-blocking I/O).  In that case, after a
read that returns nothing, errno should be set to EAGAIN.  If you
could detect that, then you would want to clear the error on the
stream, then try again (or better, call select and wait for some input
or a timeout to happen).  The trouble is that there is currently no
way in Octave to check errno, no good way to clear the error on the
stream state, and no interface to the select system call.  :-(

jwe



-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]