-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: do not crash using workers with disabled shared array buffers
This allows the repl to function normally while using the `--no-harmony-sharedarraybuffer` V8 flag. Fixes: #39717 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
- Loading branch information
1 parent
18ff583
commit f26a4d0
Showing
4 changed files
with
47 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Flags: --no-harmony-sharedarraybuffer | ||
|
||
'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); | ||
} |