Re: Does waitUntilExit really mean that?
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