mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Inside workers, using stdio is always asynchronous, so using `process.exit()` always interrupts sending of messages to the parent thread, including error messages presented over stdio. Do not use `process.exit()` and instead trigger a “real” uncaught exception. PR-URL: https://github.com/nodejs/node/pull/25769 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
14 lines
418 B
JavaScript
14 lines
418 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { Worker } = require('worker_threads');
|
|
|
|
const worker = new Worker('./does-not-exist.js', {
|
|
execArgv: ['--experimental-modules'],
|
|
});
|
|
|
|
worker.on('error', common.mustCall((err) => {
|
|
// eslint-disable-next-line node-core/no-unescaped-regexp-dot
|
|
assert(/Cannot find module .+does-not-exist.js/.test(err.message), err);
|
|
}));
|