summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/node.js3
-rw-r--r--test/parallel/test-process-emit.js20
2 files changed, 22 insertions, 1 deletions
diff --git a/src/node.js b/src/node.js
index c194c239c..41e8fb195 100644
--- a/src/node.js
+++ b/src/node.js
@@ -782,7 +782,8 @@
var signalWraps = {};
function isSignal(event) {
- return event.slice(0, 3) === 'SIG' &&
+ return typeof event === 'string' &&
+ event.slice(0, 3) === 'SIG' &&
startup.lazyConstants().hasOwnProperty(event);
}
diff --git a/test/parallel/test-process-emit.js b/test/parallel/test-process-emit.js
new file mode 100644
index 000000000..0e6d28b22
--- /dev/null
+++ b/test/parallel/test-process-emit.js
@@ -0,0 +1,20 @@
+'use strict';
+const common = require('../common');
+const assert = require('assert');
+const sym = Symbol();
+
+process.on('normal', common.mustCall(data => {
+ assert.strictEqual(data, 'normalData');
+}));
+
+process.on(sym, common.mustCall(data => {
+ assert.strictEqual(data, 'symbolData');
+}));
+
+process.on('SIGPIPE', common.mustCall(data => {
+ assert.strictEqual(data, 'signalData');
+}));
+
+process.emit('normal', 'normalData');
+process.emit(sym, 'symbolData');
+process.emit('SIGPIPE', 'signalData');