Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Quit applications politely from the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Quit applications politely from the command line
Authored by: cran on Aug 27, '09 06:45:56AM

Is it really such that OS X applications (which ARE processes, otherwise they wouldn't appear in "ps" listings) do not catch SIGTERM/SIGINT and such to shut down cleanly? Really!?

To me this seems hard to imagine. But then I don't know better.



[ Reply to This | # ]
Quit applications politely from the command line
Authored by: Sesquipedalian on Aug 27, '09 07:05:36AM
Yes, really. For example, the command one might expect to work as desired, killall -QUIT TextEdit, produces an error message saying "The application TextEdit quit unexpectedly." By all means feel free to play around with the various kill signals, but from what I can find, none of them perform the same way as pressing ⌘Q when using the application.

Obviously every application has a process at its core, so you will see at least one process for each application, but an application is more than just a process.

[ Reply to This | # ]

Quit applications politely from the command line
Authored by: cran on Aug 27, '09 11:32:19PM

I just tried it: "killall -TERM TextEdit" works as I expect, producing no error message but just telling TextEdit to die asap. "killall -QUIT" indeed does behave different. But SIGTERM is what's usually sent if you do not give an explicit signal.

On the other hand it's right that on SIGTERM TextEdit won't ask you for saving your half-finished document, it will discard all changes. But that's what I expect if I say "dear program, please terminate asap".

Now I think I understand your hint and what it's for, I got it wrong after the first read. But I am still pretty sure that most OS X programs (application or not) do handle SIGTERM and do some clean up before exiting.



[ Reply to This | # ]
Quit applications politely from the command line
Authored by: Sesquipedalian on Aug 28, '09 10:38:43AM
Perhaps this example will help further illuminate the matter: I use an application called Journler that updates its internal database as part of its quitting procedure. killall Journler kills the app without triggering that procedure.

For further reading, you might be interested in this.

[ Reply to This | # ]