mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
PR-URL: https://github.com/nodejs/node/pull/56496 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: James M Snell <jasnell@gmail.com>
22 lines
570 B
JavaScript
22 lines
570 B
JavaScript
'use strict';
|
|
|
|
const { isWindows, mustCall, skip } = require('../common');
|
|
const { throws } = require('assert');
|
|
const { isMainThread, Worker } = require('worker_threads');
|
|
|
|
if (isWindows) {
|
|
skip('process.execve is not available in Windows');
|
|
}
|
|
|
|
if (isMainThread) {
|
|
new Worker(__filename);
|
|
} else {
|
|
throws(mustCall(() => {
|
|
process.execve(
|
|
process.execPath,
|
|
[__filename, 'replaced'],
|
|
{ ...process.env, EXECVE_A: 'FIRST', EXECVE_B: 'SECOND', CWD: process.cwd() }
|
|
);
|
|
}), { name: 'TypeError', code: 'ERR_WORKER_UNSUPPORTED_OPERATION' });
|
|
}
|