• 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: Using NSPipe to get system command output
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSPipe to get system command output


  • Subject: Re: Using NSPipe to get system command output
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 13 Aug 2012 19:47:37 -0500

On Aug 13, 2012, at 6:52 PM, Andy Lee wrote:

> You're very welcome. Although I wonder if you could simply replace the do-while loop with a call to NSTask's waitUntilExit method.

You can't unless you issue a -read..InBackgroundAndNotify method on the output file handle.  Otherwise, if you're not reading from the pipe, it can fill up and block the task.  Then you're deadlocked.

Also, -waitUntilExit has the nasty problem of running the run loop in the default mode.  On the main thread, that mode is likely to have various and sundry sources and timers scheduled on it.  That means that they may fire during your call to -waitUntilExit, which can have unpleasant side effects that you weren't expecting, possibly including recursion.

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Using NSPipe to get system command output (From: Charlie Dickman <email@hidden>)
 >Re: Using NSPipe to get system command output (From: Kyle Sluder <email@hidden>)
 >Re: Using NSPipe to get system command output (From: Andy Lee <email@hidden>)
 >Re: Using NSPipe to get system command output (From: Charlie Dickman <email@hidden>)
 >Re: Using NSPipe to get system command output (From: Andy Lee <email@hidden>)

  • Prev by Date: Re: NSTextView paste:
  • Next by Date: Re: Help Indexer error - what does it MEAN?
  • Previous by thread: Re: Using NSPipe to get system command output
  • Next by thread: Re: Using NSPipe to get system command output
  • Index(es):
    • Date
    • Thread