diff --git a/doc/api/process.md b/doc/api/process.md index 2ba2794cff..8fb0e38834 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -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` diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index 335b886830..36ac1046da 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -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'); } diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 5c3505f25a..9dd936c8ba 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -501,7 +501,7 @@ static void ReallyExit(const FunctionCallbackInfo& 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); diff --git a/test/parallel/test-process-execve-abort.js b/test/parallel/test-process-execve-abort.js index 515e1c1f8f..4a36944ac8 100644 --- a/test/parallel/test-process-execve-abort.js +++ b/test/parallel/test-process-execve-abort.js @@ -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') { diff --git a/test/parallel/test-process-execve-on-exit.js b/test/parallel/test-process-execve-on-exit.js index e6859b51fe..ff01b0b50e 100644 --- a/test/parallel/test-process-execve-on-exit.js +++ b/test/parallel/test-process-execve-on-exit.js @@ -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') { diff --git a/test/parallel/test-process-execve-permission-fail.js b/test/parallel/test-process-execve-permission-fail.js index 0398552edd..f1fceca270 100644 --- a/test/parallel/test-process-execve-permission-fail.js +++ b/test/parallel/test-process-execve-permission-fail.js @@ -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') { diff --git a/test/parallel/test-process-execve-permission-granted.js b/test/parallel/test-process-execve-permission-granted.js index 3521b240f0..f4d36d83f0 100644 --- a/test/parallel/test-process-execve-permission-granted.js +++ b/test/parallel/test-process-execve-permission-granted.js @@ -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') { diff --git a/test/parallel/test-process-execve-socket.js b/test/parallel/test-process-execve-socket.js index 9d85f7ce2b..d113f690a0 100644 --- a/test/parallel/test-process-execve-socket.js +++ b/test/parallel/test-process-execve-socket.js @@ -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') { diff --git a/test/parallel/test-process-execve-validation.js b/test/parallel/test-process-execve-validation.js index 339d53d573..febaa12d06 100644 --- a/test/parallel/test-process-execve-validation.js +++ b/test/parallel/test-process-execve-validation.js @@ -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(() => { diff --git a/test/parallel/test-process-execve-worker-threads.js b/test/parallel/test-process-execve-worker-threads.js index 5b93f45bbe..551f6f7ac3 100644 --- a/test/parallel/test-process-execve-worker-threads.js +++ b/test/parallel/test-process-execve-worker-threads.js @@ -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) { diff --git a/test/parallel/test-process-execve.js b/test/parallel/test-process-execve.js index 1cc9bf8701..b0d4bc0515 100644 --- a/test/parallel/test-process-execve.js +++ b/test/parallel/test-process-execve.js @@ -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') {