Re: NSTask stealth bug in readDataOfLength!! :(
Re: NSTask stealth bug in readDataOfLength!! :(
- Subject: Re: NSTask stealth bug in readDataOfLength!! :(
- From: "Theodore H. Smith" <email@hidden>
- Date: Wed, 25 Oct 2006 19:05:00 +0100
Nevermind.
I solved the problem.
Lesson learnt? NEVER USE NSTASK! It sucks. I used system() instead :(
I spent about 2 hours trying to figure out the bugs in that bloody
NSTask. And spend 30 mins or so converting it to system() which works
just fine. I did have to pipe the results into a file, but even the
overhead of reading that file back out, is better than dealing with
the fact that NSTask sucks. :(
On 25 Oct 2006, at 18:19, Theodore H. Smith wrote:
I'm trying to debug this strange problem with NSTask:
NSTask* t = [NSTask new];
[t setLaunchPath:@"/usr/bin/curl"];
[t setArguments:array];
NSPipe* pope = [NSPipe pipe];
NSFileHandle* fh = [pope fileHandleForReading];
[t setStandardOutput:pope];
[t launch];
NSData* data = [fh readDataToEndOfFile];
Now readDataToEndOfFile seems to call through to readDataOfLength.
Upon running, this gives me an
"_NSfileHandleRaiseOperatioNException". No idea why.
But if I step through the debugger, it works just fine!!!
So if i try to debug it, the bug goes away. This is why I call it a
stealth bug. It's making no sense. Any answers anyone??
Why is the task raising an exception anyhow? Is it because the task
hasn't loaded yet or what?
This is driving me crazy! I follow the examples here http://
www.cocoadev.com/index.pl?WrappingUnixApps and it doesn't work!! :(
--
http://elfdata.com/plugin/
--
http://elfdata.com/plugin/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden