mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
PR-URL: https://github.com/nodejs/node/pull/60845 Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
22 lines
600 B
JavaScript
22 lines
600 B
JavaScript
'use strict';
|
|
|
|
const { isWindows, isIBMi, mustCall, skip } = require('../common');
|
|
const assert = require('assert');
|
|
const { isMainThread, Worker } = require('worker_threads');
|
|
|
|
if (isWindows || isIBMi) {
|
|
skip('process.execve is not available in Windows or IBM i');
|
|
}
|
|
|
|
if (isMainThread) {
|
|
new Worker(__filename);
|
|
} else {
|
|
assert.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' });
|
|
}
|