• 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: Alastair Houghton <email@hidden>
  • Date: Wed, 25 Oct 2006 19:42:37 +0100

On Oct 25, 2006, at 6:19 PM, 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??

My guess is that what's probably happening is that your program is getting a signal (probably SIGCHILD or SIGPIPE or something), which is causing the read() call inside -readDataOfLength: to return prematurely with EINTR, hence the exception you're seeing. It's quite annoying that the -readData methods don't handle this better. I think in at least one place in our code we intentionally avoid using NSFileHandle's -read methods for this very reason.


I'm sure we must have filed a bug report about this, but I can't find anything. Maybe my colleague Chris did, I'm not sure.

Kind regards,

Alastair.

--
http://alastairs-place.net


_______________________________________________ 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
  • Follow-Ups:
    • Re: NSTask stealth bug in readDataOfLength!! :(
      • From: Chris Suter <email@hidden>
    • Re: NSTask stealth bug in readDataOfLength!! :(
      • From: Thomas Engelmeier <email@hidden>
References: 
 >NSTask stealth bug in readDataOfLength!! :( (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Stationary or Template documents
  • 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