TIC-80 icon indicating copy to clipboard operation
TIC-80 copied to clipboard

TIC-80 could use SIGINT better

Open josefnpat opened this issue 6 years ago • 3 comments

So when you run TIC-80, create an unsaved edit, and send SIGINT (C-c), the warning screen appears in game, and the binary refuses to quit.

Normally, I expect an application to quit from a SIGINT (program interrupt). To further research how unix applications should handle a program interrupt, I looked around. This article on building IDL applications mentions specifically:

To manually stop programs that are running, issue a keyboard interrupt [..]

Of course the argument here is that you could just use SIGQUIT (C+\).

I think that SIGINT should do one of two things:

  1. Quit immediately.
  2. Show the warning, and on a second SIGINT, quit.

I still feel like 2) is still strange for unix applications, which is why it might make the most sense to save the current file to a backup location, and then end execution.

josefnpat avatar Oct 26 '17 19:10 josefnpat

It seems to me, that android do not send KILL signal. https://developer.android.com/guide/components/activities/activity-lifecycle.html https://forum.qt.io/topic/65773/getting-kill-signal-on-android/5

jahodfra avatar Dec 10 '17 08:12 jahodfra

I feel like this requested behavior is a Linux/Unix-ism - so I think it needs to be behind a compile flag? I definitely don't want the app to hard-quit with Ctrl-C on a Mac - no other Mac apps do that. That is not standard/correct behavior.

joshgoebel avatar Jan 25 '22 01:01 joshgoebel

Also even from a LInux perspective you could make the argument that TIC-80 is a shell... does Ctrl-C with no program running terminate a shell on Linux? On my Mac Ctrl-C will kill programs running inside the shell/console, but it does nothing to the shell/console itself... Perhaps the correct behavior here would be for Ctrl-C to terminate the game that is running inside TIC-80 rather than to terminate TIC-80 itself...

It seems there is at least some ambiguity here on "what to terminate"...

joshgoebel avatar Jan 25 '22 01:01 joshgoebel