Skip to content

Commit c8ffb7d

Browse files
committed
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.
1 parent b2405e9 commit c8ffb7d

10 files changed

+27
-27
lines changed

doc/api/process.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3379,7 +3379,7 @@ any exit or close events and without running any cleanup handler.
33793379
33803380
This function will never return, unless an error occurred.
33813381
3382-
This function is not available on Windows.
3382+
This function is not available on Windows or IBM i.
33833383
33843384
## `process.report`
33853385

src/node_process_methods.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ static void ReallyExit(const FunctionCallbackInfo<Value>& args) {
497497
env->Exit(code);
498498
}
499499

500-
#ifdef __POSIX__
500+
#if defined __POSIX__ && !defined(__PASE__)
501501
inline int persist_standard_stream(int fd) {
502502
int flags = fcntl(fd, F_GETFD, 0);
503503

@@ -779,7 +779,7 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
779779
SetMethod(isolate, target, "dlopen", binding::DLOpen);
780780
SetMethod(isolate, target, "reallyExit", ReallyExit);
781781

782-
#ifdef __POSIX__
782+
#if defined __POSIX__ && !defined(__PASE__)
783783
SetMethod(isolate, target, "execve", Execve);
784784
#endif
785785
SetMethodNoSideEffect(isolate, target, "uptime", Uptime);
@@ -826,7 +826,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
826826
registry->Register(binding::DLOpen);
827827
registry->Register(ReallyExit);
828828

829-
#ifdef __POSIX__
829+
#if defined __POSIX__ && !defined(__PASE__)
830830
registry->Register(Execve);
831831
#endif
832832
registry->Register(Uptime);

test/parallel/test-process-execve-abort.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

3-
const { skip, isWindows } = require('../common');
3+
const { skip, isWindows, isIBMi } = require('../common');
44
const { ok } = require('assert');
55
const { spawnSync } = require('child_process');
66
const { isMainThread } = require('worker_threads');
77

88
if (!isMainThread) {
99
skip('process.execve is not available in Workers');
10-
} else if (isWindows) {
11-
skip('process.execve is not available in Windows');
10+
} else if (isWindows || isIBMi) {
11+
skip('process.execve is not available in Windows or IBM i');
1212
}
1313

1414
if (process.argv[2] === 'child') {

test/parallel/test-process-execve-on-exit.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
22

3-
const { mustNotCall, skip, isWindows } = require('../common');
3+
const { mustNotCall, skip, isWindows, isIBMi } = require('../common');
44
const { strictEqual } = require('assert');
55
const { isMainThread } = require('worker_threads');
66

77
if (!isMainThread) {
88
skip('process.execve is not available in Workers');
9-
} else if (isWindows) {
10-
skip('process.execve is not available in Windows');
9+
} else if (isWindows || isIBMi) {
10+
skip('process.execve is not available in Windows or IBM i');
1111
}
1212

1313
if (process.argv[2] === 'replaced') {

test/parallel/test-process-execve-permission-fail.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
'use strict';
44

5-
const { mustCall, skip, isWindows } = require('../common');
5+
const { mustCall, skip, isWindows, isIBMi } = require('../common');
66
const { fail, throws } = require('assert');
77
const { isMainThread } = require('worker_threads');
88

99
if (!isMainThread) {
1010
skip('process.execve is not available in Workers');
11-
} else if (isWindows) {
12-
skip('process.execve is not available in Windows');
11+
} else if (isWindows || isIBMi) {
12+
skip('process.execve is not available in Windows or IBM i');
1313
}
1414

1515
if (process.argv[2] === 'replaced') {

test/parallel/test-process-execve-permission-granted.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
'use strict';
44

5-
const { skip, isWindows } = require('../common');
5+
const { skip, isWindows, isIBMi } = require('../common');
66
const { deepStrictEqual } = require('assert');
77
const { isMainThread } = require('worker_threads');
88

99
if (!isMainThread) {
1010
skip('process.execve is not available in Workers');
11-
} else if (isWindows) {
12-
skip('process.execve is not available in Windows');
11+
} else if (isWindows || isIBMi) {
12+
skip('process.execve is not available in Windows or IBM i');
1313
}
1414

1515
if (process.argv[2] === 'replaced') {

test/parallel/test-process-execve-socket.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

3-
const { mustCall, mustNotCall, skip, isWindows } = require('../common');
3+
const { mustCall, mustNotCall, skip, isWindows, isIBMi } = require('../common');
44
const { fail, ok } = require('assert');
55
const { createServer } = require('net');
66
const { isMainThread } = require('worker_threads');
77

88
if (!isMainThread) {
99
skip('process.execve is not available in Workers');
10-
} else if (isWindows) {
11-
skip('process.execve is not available in Windows');
10+
} else if (isWindows || isIBMi) {
11+
skip('process.execve is not available in Windows or IBM i');
1212
}
1313

1414
if (process.argv[2] === 'replaced') {

test/parallel/test-process-execve-validation.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

3-
const { skip, isWindows } = require('../common');
3+
const { skip, isWindows, isIBMi } = require('../common');
44
const { throws } = require('assert');
55
const { isMainThread } = require('worker_threads');
66

77
if (!isMainThread) {
88
skip('process.execve is not available in Workers');
99
}
1010

11-
if (!isWindows) {
11+
if (!isWindows && !isIBMi) {
1212
// Invalid path name
1313
{
1414
throws(() => {

test/parallel/test-process-execve-worker-threads.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
22

3-
const { isWindows, mustCall, skip } = require('../common');
3+
const { isWindows, isIBMi, mustCall, skip } = require('../common');
44
const { throws } = require('assert');
55
const { isMainThread, Worker } = require('worker_threads');
66

7-
if (isWindows) {
8-
skip('process.execve is not available in Windows');
7+
if (isWindows || isIBMi) {
8+
skip('process.execve is not available in Windows or IBM i');
99
}
1010

1111
if (isMainThread) {

test/parallel/test-process-execve.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
22

3-
const { isWindows, skip } = require('../common');
3+
const { isWindows, isIBMi, skip } = require('../common');
44
const { deepStrictEqual, fail, strictEqual } = require('assert');
55
const { isMainThread } = require('worker_threads');
66

77
if (!isMainThread) {
88
skip('process.execve is not available in Workers');
9-
} else if (isWindows) {
10-
skip('process.execve is not available in Windows');
9+
} else if (isWindows || isIBMi) {
10+
skip('process.execve is not available in Windows or IBM i');
1111
}
1212

1313
if (process.argv[2] === 'replaced') {

0 commit comments

Comments
 (0)