NSTask flaky about posting terminate notification, in 10.6
NSTask flaky about posting terminate notification, in 10.6
- Subject: NSTask flaky about posting terminate notification, in 10.6
- From: Jens Alfke <email@hidden>
- Date: Wed, 2 Sep 2009 13:11:20 -0700
After upgrading to 10.6 I started seeing problems with my app Murky,
which uses NSTask to run the Mercurial version-control tool. What
seems to be going on is that an asynchronous NSTask sometimes (maybe
5% of the time?) fails to post its NSTaskDidTerminateNotification.
When this happens I see the task's stdout and stderr file descriptors
being closed, and if I check the task's isRunning property it returns
NO, but the notification never arrives. Unfortunately this leads to
infinite loops in situations where I'm spinning the runloop waiting
for the task to finish.
This seems like a regression in NSTask. I had never seen it before in
10.5, and I've debugged a bit to check if I was doing anything wrong;
I found some issues with the way I was polling the runloop, and have
added a partial workaround for the problem, but something still seems
wrong in NSTask itself.
You can see my code here:
http://bitbucket.org/snej/myutilities/src/5cab3034d3a1/MYTask.m
Line 195 adds an observer for the notification, line 200 launches the
task, the notification handler's at 275. The runloop polling is at 331.
—Jens_______________________________________________
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