Skip to content
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

Changed unix version of .kill function to send signals to all processes #169

Merged
merged 4 commits into from
Dec 31, 2017
Merged

Changed unix version of .kill function to send signals to all processes #169

merged 4 commits into from
Dec 31, 2017

Conversation

Daniel-Abrecht
Copy link
Contributor

This patch changes the unix version of the .kill function to send the signal to all processes of the process group of the pts using the TIOCSIG or TIOCSIGNAL ioctl, except for the SIGHUP signal, for which the original behaviour is retained.

See #167 for details

@jerch
Copy link
Collaborator

jerch commented Dec 17, 2017

Just one remark - imho AIX has none of the ioctls, might be better to change the #error into a warning and import PtyKill to JS only if it actually does something (the ioctls were defined). That way it will keep compiling on ancient unix systems (not sure if it did in the first place lol).

@Daniel-Abrecht
Copy link
Contributor Author

Ok, now it should output a warning, not export PtyKill, and fall back to process.kill if TIOCSIG and TIOCSIGNAL aren't available.

@jerch
Copy link
Collaborator

jerch commented Dec 17, 2017

LGTM 👍

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few minor comments

}
} catch (e) { /* swallow */ }
} else {
// Unknown signal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's throw a new Error here to make known that nothing happened.

signal = signal || 'SIGHUP';
if (signal in os.constants.signals) {
try {
if (pty.kill && signal !== 'SIGHUP') {
Copy link
Member

@Tyriar Tyriar Dec 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment explaining why this is needed would be good here.

src/unix/pty.cc Outdated
NAN_METHOD(PtyKill) {
Nan::HandleScope scope;

if (info.Length() != 2 || !info[0]->IsNumber()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have check the type of info[1]

@Daniel-Abrecht
Copy link
Contributor Author

Ok, I've made the changes.

@Tyriar
Copy link
Member

Tyriar commented Dec 31, 2017

Thanks! 😃

@Tyriar Tyriar merged commit 13b1e68 into microsoft:master Dec 31, 2017
@Tyriar Tyriar added this to the 0.7.5 milestone Dec 31, 2017
Tyriar added a commit that referenced this pull request Jul 20, 2018
…nge"

This reverts commit 13b1e68, reversing
changes made to 12caa78.
@lbogdan
Copy link

lbogdan commented Nov 17, 2021

Hey @Tyriar ,

Do you remember the reason you reverted this?

@Daniel-Abrecht
Copy link
Contributor Author

Daniel-Abrecht commented Nov 17, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants