Which signal is emitted when the STOP button is clicked ?
I'm part of a multiplayer repl with NodeJS, and we use a database to store informations, but when I stop the process, and when it stops automatically around 1AM GTM, Database is still open, and we lose data. My question is, how can I handle the STOP button press event in my code in order to execute some code before the repl stops (close database, deny transactions...)
Thank you.
AnshikaSinghal
my emit is not working in replit to code faster please help
Coder100
process.on("exit", () => { })
the signal is just your standard ^C (ctrl+c)
programmeruser
@Coder100 it's not SIGINT
it's SIGKILL
so the above code will not work.
SIGKILL
is emitted which cannot be caught (which would defeat the purpose).@programmeruser So I can't handle it ? :(
@Unaty498 no, due to how linux works.
@programmeruser So is there a way to configure the STOP button in order to make it emit
SIGTERM
orSIGINT
instead ofSIGKILL
?@Unaty498 unfortunately, no.
@programmeruser oh, sad, but thanks for the answer anyway