• 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: Does waitUntilExit really mean that?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does waitUntilExit really mean that?


  • Subject: Re: Does waitUntilExit really mean that?
  • From: Gwynne Raskind <email@hidden>
  • Date: Sat, 11 Apr 2009 14:50:17 -0400

On Apr 11, 2009, at 2:29 PM, Michael Domino wrote:
I ended up throwing out NSTask in favor of popen for running hdiutil, and my code seems much more stable now. Did I shoot myself in the foot some other way? I'm executing this in a pthread of its own. I also kept getting exceptions thrown for nil arguments to NSConreteTask, besides the problems getting the standard output either partially or not at all. This seems better:


FWIW, I was having some strange issues with NSTask and setuid child processes (not setuid root, mind you). I tried to peek at what NSTask was doing behind the scenes, and I found some rather confusing usages of CFFileDescriptor, kqueue(), and the like in the disassembly. My eventual solution was to roll my own version of NSTask which gave me full control over the way the child process was set up, from pre- fork() to to post-exec(). In particular, I use some of the lower-level UNIX calls directly (dup2()/close() instead of CFFileDescriptor, waitpid() on a separate thread instead of kqueue(), etc.). I was able to track down the issue I was having with the setuid process once I had the ability to trace the code running between fork() and execve().

The moral of the story is: Just because Apple provides a closed-source high-level Cocoa solution to a low-level UNIX problem, doesn't mean the Cocoa way is always the best.

-- Gwynne, Daughter of the Code
"This whole world is an asylum for the incurable."
_______________________________________________

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


  • Follow-Ups:
    • Re: Does waitUntilExit really mean that?
      • From: Uli Kusterer <email@hidden>
References: 
 >Does waitUntilExit really mean that? (From: Michael Domino <email@hidden>)
 >Re: Does waitUntilExit really mean that? (From: Ken Thomases <email@hidden>)
 >Re: Does waitUntilExit really mean that? (From: Michael Domino <email@hidden>)
 >Re: Does waitUntilExit really mean that? (From: Ken Thomases <email@hidden>)
 >Re: Does waitUntilExit really mean that? (From: Michael Domino <email@hidden>)
 >Re: Does waitUntilExit really mean that? (From: Michael Domino <email@hidden>)

  • Prev by Date: Re: Does waitUntilExit really mean that?
  • Next by Date: Re: NSLog with %f and comparisons using ==
  • Previous by thread: Re: Does waitUntilExit really mean that?
  • Next by thread: Re: Does waitUntilExit really mean that?
  • Index(es):
    • Date
    • Thread