Re: some NSTask Questons.
Re: some NSTask Questons.
- Subject: Re: some NSTask Questons.
- From: Nicholas <email@hidden>
- Date: Sat, 24 Jul 2004 12:31:02 -0400
There are two methods in NSTask (which I have not used so you should
play with it a little) that are supposed to handle this. They are
-suspend and -resume. However, this does not stop and relaunch the
task it simply suspends and resumes its execution where it left off.
Be careful to balance the number of suspends and resumes.
However, if you need to re-launch the executable then you must create a
new instance as illustrated by Kodex.
On Jul 21, 2004, at 5:25 PM, Kodex wrote:
I have a unix executabe file that i want to laucnh and
stop more then once from my program. NSTask seems to
be unable to do this according to its documentation.
Is there any way i can do this successfully? Thanks!
The same NSTask instance can not be used to launch it's task more than
once. You will need to create a new NSTask instance each time you want
to launch your unix executable.
To illustrate launching the same program twice:
NSString *thePath = <path to your executable>;
NSTask *theFirstExecution = [NSTask launchedTaskWithLaunchPath:thePath
arguments:[NSArray array]];
[theFirstExecution waitUntilExit];
// Can't launch theFirstExecution again. Make another NSTask.
NSTask *theSecondExecution = [NSTask
launchedTaskWithLaunchPath:thePath arguments:[NSArray array]];
[theSecondExecution waitUntilExit];
W. W. Gilpin
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.