nodejs/test/parallel/test-process-execve-worker-threads.js
Abdirahim Musse 963b24e9a6
process: disable building execve on IBM i
The `execve` syscall does exist on IBM i but
it has caveats that make it not usable in Node.js context.

These changes disable building with `execve` like Windows does.

PR-URL: https://github.com/nodejs/node/pull/57883
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2025-04-18 11:07:51 +00:00

22 lines
597 B
JavaScript

'use strict';
const { isWindows, isIBMi, mustCall, skip } = require('../common');
const { throws } = 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 {
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' });
}