NSTask hangs on launch
NSTask hangs on launch
- Subject: NSTask hangs on launch
- From: Scott Thompson <email@hidden>
- Date: Tue, 18 Oct 2005 14:22:07 -0500
Our application uses NSTask, in conjunction with the "ditto" command
line tool to copy some first-run files into the user's application
support folder. This task seemed to work well until a recent change.
We decided to split the task into two copy phases (one for platform
independent stuff and one for platform dependent stuff). After making
this change, our application now hangs.
Debugging through things, we discovered that the first NSTask appears
to complete without incident. The second NSTask hangs somewhere in
the "launch" call. We wanted to make sure that this wasn't specific
to the "ditto" program so we changed the commands issued in the tasks
to be "ls" calls. Again, we hang trying to launch the second task.
Our use of NSTask is very, very basic. Specifically, we are not
using pipes or anything of that nature. The code we have is
identical in most important respects to that found in Apple's
documentation, third party books, and on-line code samples. Many of
the mentions of crashes I've seen on the Web seem to be the result of
buffering issues with NSPipes, stdio, and stderr. We are not using
any of that functionality. stdio and stderr are directed to a
NSFileHandle to the bit bucket.
This code was being run from the "applicationWillFinishLaunching"
method of our app delegate. It is interesting to note that when we
move the code to the "applicationDidFinishLaunching" the code hangs
on the first task, rather than the second. To my knowledge the only
thing that happens (on our end) between those two calls is that we
open our default document. Whatever we are doing to cause the code
to hang, then, it seems that we are irritating it by opening our
default document.
My biggest problem with this hang is I've run out of ideas about how
to track down the problem. It seems reasonable to me that it is our
application is doing something "different" which causes these tasks
to fail, but I don't really have a clear idea about what that might
be. Other than this code, we don't really do anything that I would
obviously tie to process management. We haven't developed things far
enough to have any other multi-process or multi-threading code in place.
Can anyone suggest things I might look for in the debugger, or in any
of the other developer tools for that matter, which might help me
track down what the problem is and how I might resolve it? I am also
interested in hearing about the resolutions for similar situations if
anyone has encountered them.
_______________________________________________
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