Re: Moriarity samplecode (taskwrapper)
Re: Moriarity samplecode (taskwrapper)
- Subject: Re: Moriarity samplecode (taskwrapper)
- From: Gerben Wierda <email@hidden>
- Date: Wed, 9 Jan 2002 22:22:25 +0100
On Wednesday, January 9, 2002, at 04:30 , Jody Fairchild wrote:
i'm not sure what aspect of the code gerben is talking about, but in the
course of adapting the task wrapper stuff to my own purposes, i
discovered
what seems to be a bug in the getData method.
in my usage of the task wrapper sample code, this bug was causing the
app
to keep attempting to read from the filehandle even after there was no
data available and the NSTask had finished. i noticed it because the
app
was suddenly eating 70% of my cpu time when it should have been sitting
idle.
Yes, that is the second bug I discovered.
i also needed to modify the code to be able to deal with all the stdio
filehandles separately (moriarity's taskwrapper doesn't deal with stdin
at
all, and combines stdout and stderr on output), and report the return
value from the external process. if anyone's interested, i'd be happy
to
pass along my version via email. if there ends up being some demand for
it, i can toss it up on the web somewhere.
There was another bug in the original code where the TaskWrapper is
never deallocated and reused (and it cannot handle that so results are
mixed). You can see that by trying to run Moriarity more than once. That
one was fixed by the author at Apple as well. It just hasn't made it to
the web site yet (last time I checked).
G