-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
killing the subcommand if the main command is terminated #411
Conversation
@@ -1100,4 +1109,3 @@ function exists(file) { | |||
return false; | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the newline here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, my atom editor kills extra lines. I add the line again.
Tests would be great, 👍 otherwise |
Should it be an option or default? |
I think this should be the default behavior. If you try to store the process pid, you will get only the pid of the main process.
Returns something like:
If you try to kill that pid (55274), the sub command (55275) keeps running. |
} | ||
process.on('exit',processClosing ); | ||
process.on('SIGINT', processClosing ); | ||
process.on('SIGHUB', processClosing ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIGHUP
? Have you test all this listener? @thomashoffmann1979
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIGHUP seem to be right see https://en.wikipedia.org/?title=SIGHUP. I will add a test for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea. To double check, I mean here we should use SIGHUP
instead of SIGHUB
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you are right! I will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it. Now the exit signal of the main process is used for the sub command, too.
Hi @thomashoffmann1979 , we can merge this if you add a test. Thank you. |
This should be default in my opinion - seems expected behavior to kill the whole process. |
test if proc was killed after 100ms
Is the only thing that prevents this from being merged that it has conflicts? Would really like this functionality included in Commander.js. |
@thomashoffmann1979 Can you solve the conflict in this PR. I will merge it. |
Seems like the build fails for Node.js v0.6 and v0.8. Is this still something that should be supported and have anyone looked into what the cause is? |
closing in favor of #632 |
The sub command keeps running if the main command was killed. I added listeners to that events to terminate the sub command.