2023-04-20 13:01:09 +02:00
|
|
|
// Flags: --enable-sharedarraybuffer-per-context
|
2023-02-18 11:18:04 +01:00
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const { Worker } = require('worker_threads');
|
|
|
|
|
|
|
|
// Regression test for https://github.com/nodejs/node/issues/39717.
|
|
|
|
|
|
|
|
// Do not use isMainThread so that this test itself can be run inside a Worker.
|
|
|
|
if (!process.env.HAS_STARTED_WORKER) {
|
|
|
|
process.env.HAS_STARTED_WORKER = 1;
|
|
|
|
const w = new Worker(__filename);
|
|
|
|
|
|
|
|
w.on('exit', common.mustCall((status) => {
|
|
|
|
assert.strictEqual(status, 2);
|
|
|
|
}));
|
|
|
|
} else {
|
|
|
|
process.exit(2);
|
|
|
|
}
|