Re: NSTask vs. popen vs. System
Re: NSTask vs. popen vs. System
- Subject: Re: NSTask vs. popen vs. System
- From: Jeff Disher <email@hidden>
- Date: Tue, 3 Dec 2002 21:00:55 -0500
If that is the case then you could use:
[task waitUntilExit];
to block until the receiving task terminates. This also lets you
launch the task, perform other operations while it runs, then block
before the part of your code that requires the result of the task.
Note, however, that this is no better than system or popen when it
comes to waiting for your system to return to another state. For
example, certain disk mount/unmount operations are performed by command
line programs asynchronously. I only mention that because I was really
annoyed with NSTask not waiting for something to terminate after I sent
it that message. I later found out that it was waiting for it to
terminate but the command line app I was running had invoked the system
call in some asynchronous way.
Hope that helps,
Jeff.
On Tuesday, December 3, 2002, at 08:46 PM, matt neuburg wrote:
On Tue, 03 Dec 2002 18:19:26 +0000, Chris Ridd <email@hidden>
said:
Both popen and system execute the process using sh, so the arguments
you
pass have to be properly quoted and escaped. This is easy to do wrong
(hello
iTunes installer :-) and generally it is easier to just use NSTask.
But I think what the O.P. wants to know is how you would you use
NSTask synchronously (i.e. your app should block until the result is
completely in). m.
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
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.
Jeff Disher
President and Lead Developer of Spectral Class
Spectral Class: Shedding Light on Innovation
http://www.spectralclass.com/
_______________________________________________
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.