-
Notifications
You must be signed in to change notification settings - Fork 156
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
Implement process.kill()
function
#808
Conversation
Hi @stefansundin, Thank you for the patch. We need the QJS implementation as well for shell tests to pass. I will do that myself, after polishing you patch. For signals, I propose to use only standard signals from |
Thank you @xeioex. I really appreciate the assistance. I have pushed a new commit that I think incorporates your suggestions. Please let me know if there's anything you want me to change. I can squash the commits if you prefer. Just let me know. |
Thank you for the fast response.
|
b35819a
to
5a4bd92
Compare
I think I managed to do it correctly. It got a little bit tricky with the pointers since I don't think there is a helper function to do these comparisons. But it is working and there are length checks so I think it is secure. |
3834d27
to
ed73d99
Compare
Hi @stefansundin, I added QuickJS part. I also added |
ed73d99
to
d3bcd9b
Compare
I reviewed it and it looks great. 👍 I rebuilt my project and tested with the new changes and it worked. I tried to build with QuickJS to test that but I encountered a compilation issue (building in docker):
In any case, I squashed the commits since I think you probably tested QuickJS. :) |
Something like
Thank you for the contribution. Next week @VadimZhestikov will do the review of QuickJS patches, and will merge the PR. I will also unsquash my QuickJS commits. |
Thanks for the However, I think think there may be an issue in the QuickJS implementation, I got this error when attempting to call
|
Previously, it ignored changes to environment variables introduced with "env" directive.
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.
Looks good
@stefansundin Thank you, committed |
Nice!! I just retested QuickJS and I can confirm that the error I posted above no longer happens and the signal is sent correctly. 👍 |
Proposed changes
This PR implements the
process.kill()
function, using the same API as Node.js. https://nodejs.org/api/process.html#processkillpid-signalMy use case for this function is not to kill processes, but to send other signals, like
SIGHUP
. But the default is to sendSIGTERM
, just like in Node.js.I am not 100% sure that I am using the correct string functions to compare the input with the signal names. It is working but I feel like it is not the proper way to do it. Please review the patch and let me know what the proper way of doing things are.
I am using
#ifdef
for almost all signal names, except forSIGTERM
. Not sure if it is strictly necessary but I don't think all signals are defined for all platforms?I tested this on Debian 12.
Checklist
Before creating a PR, run through this checklist and mark each as complete:
CONTRIBUTING
document