Re: running bash script...
Re: running bash script...
- Subject: Re: running bash script...
- From: Nicko van Someren <email@hidden>
- Date: Thu, 27 Jan 2005 17:43:13 +0000
On 27 Jan 2005, at 17:07, Martha I. Espinosa wrote:
Good Morning,
It's afternoon here. You Americans are so parochial :-)
I want to run a bash script at the end of my application when the user
clicks on the "quit" button.... Should I use NSTask?
That's a good quesiton. In most cases you would almost certainly want
to run sub-tasks in an NSTask. However if you start an NSTask just
before termination and don't wait for it to complete then I think you
may find it will get killed when the parent process (your application)
terminates. So what you probably want to do is implement
applicationShouldTerminate: in the application delegate, start the task
there, register for the NSTaskDidTerminateNotification notification,
return NSTerminateLater, then catch the notification and call
replyToApplicationShouldTerminate: on the application to complete the
termination process.
The above is probably the "right" way to do what you want, but it's a
bit of a pain. Alternatively you could just call system() from the C
stdlib.h and hope that your shell script never hangs.
Cheers,
Nicko
_______________________________________________
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