On Tue, Sep 14, 2010 at 2:14 AM, Michael D Godfrey
<address@hidden> wrote:
On 09/13/2010 03:54 PM, Ben Abbott wrote:
However, I did find an approach that eliminates all errors with pipes. I don't understand why this works for gl2ps, but when I add *both* the waitpid() and pclose(pid), then I get no errors.
pid = popen ("cat > test.eps", "w");
drawnow ("eps" , sprintf ("%d" , pid));
waitpid (pid);
pclose (pid);
I have a few more changes to make to the printing routines. With some luck I'll post another proposed changeset this evening.
Ben
This is very weird.
waitpid(pid) waits on a change of state of a process
id, not a file or pipe descriptor. Also, the pid passed to
drawnow() is, according
to Shai, passed by value.
I fail to understand why passing it as a value has any effect on this issue. After all it is just an integer, so passing it by value should not effect any usage of it. It's just that changing it's value is pointless, but using the value is OK.
Shai