|
From: | Michael D Godfrey |
Subject: | Re: wait_for_file ?? [GL2PS error: Bad file pointer] |
Date: | Mon, 13 Sep 2010 16:14:17 -0700 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Thunderbird/3.1.3 |
On 09/13/2010 03:54 PM, Ben Abbott wrote:
This is very weird. waitpid(pid) waits on a change of state of a processHowever, 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 id, not a file or pipe descriptor. Also, the pid passed to drawnow() is, according to Shai, passed by value. But, it is possible that something that waitpid looks at in the pipe descriptor does change and that makes it work. Is there any one who knows if this should really work? It would be useful to time how long the waitpid actually waits. If it waits for some time then it is definitely seeing a change in the descriptor pointed to by pid. The pclose() is definitely needed. Michael |
[Prev in Thread] | Current Thread | [Next in Thread] |