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>
This commit is contained in:
Abdirahim Musse 2025-04-18 06:07:51 -05:00 committed by GitHub
parent 782c2e0fe4
commit 963b24e9a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 28 additions and 28 deletions

View File

@ -3379,7 +3379,7 @@ any exit or close events and without running any cleanup handler.
This function will never return, unless an error occurred.
This function is not available on Windows.
This function is not available on Windows or IBM i.
## `process.report`

View File

@ -286,7 +286,7 @@ function wrapProcessMethods(binding) {
if (!isMainThread) {
throw new ERR_WORKER_UNSUPPORTED_OPERATION('Calling process.execve');
} else if (process.platform === 'win32') {
} else if (process.platform === 'win32' || process.platform === 'os400') {
throw new ERR_FEATURE_UNAVAILABLE_ON_PLATFORM('process.execve');
}

View File

@ -501,7 +501,7 @@ static void ReallyExit(const FunctionCallbackInfo<Value>& args) {
env->Exit(code);
}
#ifdef __POSIX__
#if defined __POSIX__ && !defined(__PASE__)
inline int persist_standard_stream(int fd) {
int flags = fcntl(fd, F_GETFD, 0);
@ -783,7 +783,7 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
SetMethod(isolate, target, "dlopen", binding::DLOpen);
SetMethod(isolate, target, "reallyExit", ReallyExit);
#ifdef __POSIX__
#if defined __POSIX__ && !defined(__PASE__)
SetMethod(isolate, target, "execve", Execve);
#endif
SetMethodNoSideEffect(isolate, target, "uptime", Uptime);
@ -830,7 +830,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(binding::DLOpen);
registry->Register(ReallyExit);
#ifdef __POSIX__
#if defined __POSIX__ && !defined(__PASE__)
registry->Register(Execve);
#endif
registry->Register(Uptime);

View File

@ -1,14 +1,14 @@
'use strict';
const { skip, isWindows } = require('../common');
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) {
skip('process.execve is not available in Windows');
} else if (isWindows || isIBMi) {
skip('process.execve is not available in Windows or IBM i');
}
if (process.argv[2] === 'child') {

View File

@ -1,13 +1,13 @@
'use strict';
const { mustNotCall, skip, isWindows } = require('../common');
const { mustNotCall, skip, isWindows, isIBMi } = require('../common');
const { strictEqual } = require('assert');
const { isMainThread } = require('worker_threads');
if (!isMainThread) {
skip('process.execve is not available in Workers');
} else if (isWindows) {
skip('process.execve is not available in Windows');
} else if (isWindows || isIBMi) {
skip('process.execve is not available in Windows or IBM i');
}
if (process.argv[2] === 'replaced') {

View File

@ -2,14 +2,14 @@
'use strict';
const { mustCall, skip, isWindows } = require('../common');
const { mustCall, skip, isWindows, isIBMi } = require('../common');
const { fail, throws } = require('assert');
const { isMainThread } = require('worker_threads');
if (!isMainThread) {
skip('process.execve is not available in Workers');
} else if (isWindows) {
skip('process.execve is not available in Windows');
} else if (isWindows || isIBMi) {
skip('process.execve is not available in Windows or IBM i');
}
if (process.argv[2] === 'replaced') {

View File

@ -2,14 +2,14 @@
'use strict';
const { skip, isWindows } = require('../common');
const { skip, isWindows, isIBMi } = require('../common');
const { deepStrictEqual } = require('assert');
const { isMainThread } = require('worker_threads');
if (!isMainThread) {
skip('process.execve is not available in Workers');
} else if (isWindows) {
skip('process.execve is not available in Windows');
} else if (isWindows || isIBMi) {
skip('process.execve is not available in Windows or IBM i');
}
if (process.argv[2] === 'replaced') {

View File

@ -1,14 +1,14 @@
'use strict';
const { mustCall, mustNotCall, skip, isWindows } = require('../common');
const { mustCall, mustNotCall, skip, isWindows, isIBMi } = require('../common');
const { fail, ok } = require('assert');
const { createServer } = require('net');
const { isMainThread } = require('worker_threads');
if (!isMainThread) {
skip('process.execve is not available in Workers');
} else if (isWindows) {
skip('process.execve is not available in Windows');
} else if (isWindows || isIBMi) {
skip('process.execve is not available in Windows or IBM i');
}
if (process.argv[2] === 'replaced') {

View File

@ -1,6 +1,6 @@
'use strict';
const { skip, isWindows } = require('../common');
const { skip, isWindows, isIBMi } = require('../common');
const { throws } = require('assert');
const { isMainThread } = require('worker_threads');
@ -8,7 +8,7 @@ if (!isMainThread) {
skip('process.execve is not available in Workers');
}
if (!isWindows) {
if (!isWindows && !isIBMi) {
// Invalid path name
{
throws(() => {

View File

@ -1,11 +1,11 @@
'use strict';
const { isWindows, mustCall, skip } = require('../common');
const { isWindows, isIBMi, 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 (isWindows || isIBMi) {
skip('process.execve is not available in Windows or IBM i');
}
if (isMainThread) {

View File

@ -1,13 +1,13 @@
'use strict';
const { isWindows, skip } = require('../common');
const { isWindows, isIBMi, skip } = require('../common');
const { deepStrictEqual, fail, strictEqual } = require('assert');
const { isMainThread } = require('worker_threads');
if (!isMainThread) {
skip('process.execve is not available in Workers');
} else if (isWindows) {
skip('process.execve is not available in Windows');
} else if (isWindows || isIBMi) {
skip('process.execve is not available in Windows or IBM i');
}
if (process.argv[2] === 'replaced') {