0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 12:10:08 +01:00
nodejs/test/parallel/test-repl-clear-immediate-crash.js
Nitzan Uziely fcc934f3d0 timers: fix arbitrary object clearImmediate errors
Fix errors that are caused by invoking clearImmediate
with arbitrary objects.

fixes: https://github.com/nodejs/node/issues/37806

PR-URL: https://github.com/nodejs/node/pull/37824
Fixes: https://github.com/nodejs/node/issues/37806
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-03-28 19:21:11 +02:00

13 lines
432 B
JavaScript

'use strict';
const common = require('../common');
const child_process = require('child_process');
const assert = require('assert');
// Regression test for https://github.com/nodejs/node/issues/37806:
const proc = child_process.spawn(process.execPath, ['-i']);
proc.on('error', common.mustNotCall());
proc.on('exit', common.mustCall((code) => {
assert.strictEqual(code, 0);
}));
proc.stdin.write('clearImmediate({});\n.exit\n');