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

Modify signals available to getsignals on WIN32 #465

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions src/vm/js/nqp-runtime/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,19 +553,7 @@ op.getsignals = function() {
return sigCache;
}

const osSigs = (function() {
if (os.platform() === 'win32') {
// Use same sigs defined for _WIN32 in MoarVM
return {
SIGHUP: 1,
SIGKILL: 9,
SIGWINCH: 28,
};
}
else {
return os.constants.signals;
}
})();
const osSigs = os.constants.signals;
const sigWanted = [
'SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT',
'SIGEMT', 'SIGFPE', 'SIGKILL', 'SIGBUS', 'SIGSEGV', 'SIGSYS',
Expand Down
9 changes: 8 additions & 1 deletion src/vm/jvm/runtime/org/perl6/nqp/runtime/IOOps.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,16 @@ private static String getNameFromVal(int signum) {
}

private static void retrieveValsWin(Map<String, Integer> sigWanted) {
// Use same sigs defined for _WIN32 in MoarVM
// Use same sigs defined for _WIN32 in MoarVM and in os.constants.signals on NodeJS
sigWanted.put("SIGHUP", 1);
sigWanted.put("SIGINT", 2);
sigWanted.put("SIGILL", 4);
sigWanted.put("SIGFPE", 8);
sigWanted.put("SIGKILL", 9);
sigWanted.put("SIGSEGV", 11);
sigWanted.put("SIGTERM", 15);
sigWanted.put("SIGBREAK", 21);
sigWanted.put("SIGABRT", 22);
sigWanted.put("SIGWINCH", 28);
}

Expand Down