mirror of
https://github.com/nodejs/node.git
synced 2025-04-29 22:40:57 +00:00

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>
27 lines
879 B
JavaScript
27 lines
879 B
JavaScript
'use strict';
|
|
|
|
const { skip, isWindows, isIBMi } = require('../common');
|
|
const { ok } = require('assert');
|
|
const { spawnSync } = require('child_process');
|
|
const { isMainThread } = require('worker_threads');
|
|
|
|
if (!isMainThread) {
|
|
skip('process.execve is not available in Workers');
|
|
} else if (isWindows || isIBMi) {
|
|
skip('process.execve is not available in Windows or IBM i');
|
|
}
|
|
|
|
if (process.argv[2] === 'child') {
|
|
process.execve(
|
|
process.execPath + '_non_existing',
|
|
[__filename, 'replaced'],
|
|
{ ...process.env, EXECVE_A: 'FIRST', EXECVE_B: 'SECOND', CWD: process.cwd() }
|
|
);
|
|
} else {
|
|
const child = spawnSync(`${process.execPath}`, [`${__filename}`, 'child']);
|
|
const stderr = child.stderr.toString();
|
|
|
|
ok(stderr.includes('process.execve failed with error code ENOENT'), stderr);
|
|
ok(stderr.includes('execve (node:internal/process/per_thread'), stderr);
|
|
}
|