• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTask stealth bug in readDataOfLength!! :(
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask stealth bug in readDataOfLength!! :(


  • Subject: Re: NSTask stealth bug in readDataOfLength!! :(
  • From: "Stephen Deken" <email@hidden>
  • Date: Wed, 25 Oct 2006 13:17:43 -0500

Lesson learnt? NEVER USE NSTASK! It sucks. I used system() instead :(

I'm pretty sure that NSTask doesn't suck, and that you're just incorrectly using a perfectly good API. I've had no problems using NSTask in this way:

process = [[NSTask alloc] init];
[process setLaunchPath:exec];
[process setCurrentDirectoryPath:[exec stringByDeletingLastPathComponent]];
[process setArguments:args];
[process setEnvironment:env];
[process setStandardError:[NSPipe pipe]];
[process setStandardInput:[NSPipe pipe]];
[process setStandardOutput:[NSPipe pipe]];
[process launch];
NSFileHandle *fh = [[process standardOutput] fileHandleForReading];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(processData:)
name:NSFileHandleReadCompletionNotification object:fh];
[fh readInBackgroundAndNotify];

Note that this is for a long-running process that gets both read from
and written to, but the principle is the same regardless.  I can't
reproduce your specific error, but I can attest that there is really
nothing wrong with NSTask.  If it's crashing, it's because you're
doing something wrong.

Stephen Deken
email@hidden
_______________________________________________
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


References: 
 >NSTask stealth bug in readDataOfLength!! :( (From: "Theodore H. Smith" <email@hidden>)
 >Re: NSTask stealth bug in readDataOfLength!! :( (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: NSSplitView iTunes Like
  • Next by Date: Re: NSTimer question: How to fire at second 00, 05, 10 etc ?
  • Previous by thread: Re: NSTask stealth bug in readDataOfLength!! :(
  • Next by thread: Re: NSTask stealth bug in readDataOfLength!! :(
  • Index(es):
    • Date
    • Thread