|Topic was automatically imported from the old Question2Answer platform.
I know that to capture “quit request” I can use the _notification and the constant NOTIFICATION_WM_QUIT_REQUEST. This works fine when the game is running normally.
The problem is that I’m running the project from command line like this:
%godot% -d -s server/main.gd --no-window
I can’t capture the quit request when running from the cmd, I’ve tried to use the _notification but it doesn’t work. The only way I can capture it is when I’m running with the -d option, then I press Ctrl+C and type q. But I can’t run the server in debug mode in production.
I need a way to execute a function when the console is closing (either using the X or using Ctrl+C).
I don’t know how to do it from Windows’ command prompt. But in Bash (on Unix-like OSes), programs have exit codes, and so a script can check for certain exit codes.
Ertain | 2022-03-12 19:33