Re: Wait for NSTask to finish
Re: Wait for NSTask to finish
- Subject: Re: Wait for NSTask to finish
- From: Rakka <email@hidden>
- Date: Thu, 17 Mar 2005 07:07:38 +1100
On Mar 16, 2005, at 10:52 PM, Will Mason wrote:
Is there a way to wait for an NSTask (or a method I created) to
finish
before continuing like waitUntilExit, but doesn't cause my app to
hang/become unresponsive?
It seems that you want to wait for the NSTask to finish and not wait
around for the NSTask at the same time. Can you let your app continue
and respond to the NSTaskDidTerminateNotification when you receive it?
What behavior exactly are you looking for?
Thanks,
Will
I don't think I can use NSTaskDidTerminateNotification as after it's done, the app goes on to run another command, if the user prefs are set to do so. It looks a bit like this.
- (id)sender
{
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"batchRPOn"])
{
[task waitUntilExit];
[self rp:nil];
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"batchRCOn"])
{
[task waitUntilExit];
[self rc:nil];
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"batchUPOn"])
{
[task waitUntilExit];
[self up:nil];
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"batchCCOn"])
{
[task waitUntilExit];
[self cuc:nil];
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"batchFETOn"])
{
[task waitUntilExit];
[self fet:nil];
}
}
But, as I said before, the app hangs and the cancel button won't work, etc...
Thanks a lot,
_______________________________________________
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