-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows - process cannot catch PM2 SIGINT
#3555
Comments
I m having same problem |
Hi there, As nodejs doc says, Windows can't handle signals as Linux does :
|
@wallet77 I have to admit knowing that when I posted - my objective was to see if any of the bright minds out there had a workaround... Since then I found this related piece of information in the I tried the recommended workaround without any success... below is a standalone code snippet I used to test the workaround.
All I see in the resulting logs is the test.js
|
Bad link for Windows graceful stop: |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Given that, why would it be impossible for pm2 to handle |
Take a look at:
Adding optional switch to enable graceful shutdown on Windows by aleksk ·
Pull Request #4474 · Unitech/pm2 (github.com)
<#4474>
Le dim. 30 mai 2021, à 06 h 52, Nicolas Traut ***@***.***> a
écrit :
… What's going wrong?
My Windows process is seemingly not getting SIGINT on stop command, since
my process.on('SIGNINT'...) handler never gets triggered - so can't do
gracefull exit!
The process correctly handles SIGINT when run from a terminal window by
doing Ctlr-C.
Given that, why would it be impossible for pm2 to handle SIGINT on
Windows if that works if the app is run from the terminal?
From what I tested, SIGINT is intercepted when running with nodemon but
not with node, so maybe nodemon implemented a workaround on Windows...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3555 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQWSXICJYXYH2GWV7IMIE3TQIKFXANCNFSM4EWCYJUQ>
.
|
What's going wrong?
My
Windows
process is seemingly not gettingSIGINT
onstop
command, since myprocess.on('SIGNINT'...)
handler never gets triggered - so can't do gracefull exit!The process correctly handles
SIGINT
when run from a terminal window by doingCtlr-C
.Furthermore, the
pm2
log head below shows that the process exited with code [1], while my signal handler exits with code [0] onSIGINT
.How could we reproduce this issue?
Run the following with
pm2 start --no-autorestart sigint.js
You never see the
GOT SIGINT
in the process log... only a series ofWaiting for SIGINT
Supporting information
pm2
version : 2.10.1node
version: 8.9.1Windows 10
pm2
log head:The text was updated successfully, but these errors were encountered: