mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 13:28:42 +00:00

When running Worker threads with `--abort-on-uncaught-exception`, do not abort the process when `worker.terminate()` is called. PR-URL: https://github.com/nodejs/node/pull/26111 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
13 lines
440 B
JavaScript
13 lines
440 B
JavaScript
// Flags: --abort-on-uncaught-exception
|
|
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { Worker } = require('worker_threads');
|
|
|
|
// Tests that --abort-on-uncaught-exception does not apply to
|
|
// termination exceptions.
|
|
|
|
const w = new Worker('while(true);', { eval: true });
|
|
w.on('online', common.mustCall(() => w.terminate()));
|
|
w.on('exit', common.mustCall((code) => assert.strictEqual(code, 1)));
|