I know that to capture "quit request" I can use the _notification and the constant NOTIFICATIONWMQUIT_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).