Shoudl LiveCode be calling exit() when terminating a Cocoa app?

Trevor DeVore lists at
Fri Aug 28 14:00:05 EDT 2020

Hi all,

This is probably a question for someone from the LC team who works on the
engine. If anyone else is familiar with how LC quits on macOS please chime
in though.

Scenario: I am running tests with the Sparkle.framework on macOS (which I
already use) with the goal of silently and automatically downloading
updates for an application that will be installed the next time the user
quits the application. You can see similar behavior in apps such as Slack.

Sparkle support: Sparkle supports this type of behavior if you set some
properties. It checks and downloads an update to the local cache and then
installs the update when the hosting app graceful terminates.

Problem: I have confirmed that Sparkle downloads the updates to the cache
but the update is never installed when I quit. I'm wondering if this is due
to the use of exit(t_exit_code) in -applicationWillTerminate in

Additional Info: While researching the problem I found an issue in the
Sparkle Github project which had some interesting information in it. The
author of the issue mentions that the app terminates by calling exit(0):

The maintainer says that Sparkle only supports graceful termination via
Cocoa notification:

So I started looking through the LiveCode source code to see how LiveCode
terminates an app when `quit` is called in LiveCode Script. If found which has the main run loop which calls `[NSApp terminate:
self];` when it is time to quit:

That looks right. But farther down in applicationWillTerminate I found a
call to `exit(t_exit_code)`;

I'm wondering if that call to exit() is what is causing problems as my
understanding is that exit() immediately causes an app to terminate.
Perhaps exit() should only be called if t_exit_code > 0?

Trevor DeVore

More information about the use-livecode mailing list