Discussion:
Finding out whether app crashed
Christiaan Hofman
2011-07-06 21:40:46 UTC
Permalink
Is there a way to figure out at launch time whether my app crashed at the last run?

thanks,
Christiaan
Markus Hitter
2011-07-07 15:48:07 UTC
Permalink
Post by Christiaan Hofman
Is there a way to figure out at launch time whether my app crashed at the last run?
Create a file somewhere at application start and remove it at normal
application close. In case of an unexpected abort, the file is still
there at the next app launch.

The classical Unix place for such stamp files is /var/run.


Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. (FH) Markus Hitter
http://www.jump-ing.de/
Christiaan Hofman
2011-07-07 17:29:30 UTC
Permalink
Post by Christiaan Hofman
Is there a way to figure out at launch time whether my app crashed at the last run?
Create a file somewhere at application start and remove it at normal application close. In case of an unexpected abort, the file is still there at the next app launch.
The classical Unix place for such stamp files is /var/run.
Markus
Is this really the preferred way of doing this?

I can imagine that somehow another instance of the app is launched, and this will notice that the last launched instance was running and was not (yet) terminated. That gives the wrong result.

Christiaan
objectwerks inc
2011-07-07 17:54:13 UTC
Permalink
Post by Christiaan Hofman
Post by Christiaan Hofman
Is there a way to figure out at launch time whether my app crashed at the last run?
Create a file somewhere at application start and remove it at normal application close. In case of an unexpected abort, the file is still there at the next app launch.
The classical Unix place for such stamp files is /var/run.
Markus
Is this really the preferred way of doing this?
I can imagine that somehow another instance of the app is launched, and this will notice that the last launched instance was running and was not (yet) terminated. That gives the wrong result.
Whether this is the best way to do it on OS X with a regular GUI type app, is not something I will address, as I don't know. However, things like pid get stored in these little files so the new app can check if the pid is still running or not so it knows if the app is a real other process app or a crashed app.
Loading...