Skip to content

Commit 8b83ab3

Browse files
abmusseRafaelGSS
authored andcommitted
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: #57883 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
1 parent 626b26d commit 8b83ab3

11 files changed

Lines changed: 28 additions & 28 deletions

‎doc/api/process.md‎

Lines changed: 1 addition & 1 deletion
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

‎lib/internal/process/per_thread.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function wrapProcessMethods(binding) {
286286

287287
if(!isMainThread){
288288
thrownewERR_WORKER_UNSUPPORTED_OPERATION('Calling process.execve');
289-
}elseif(process.platform==='win32'){
289+
}elseif(process.platform==='win32'||process.platform==='os400'){
290290
thrownewERR_FEATURE_UNAVAILABLE_ON_PLATFORM('process.execve');
291291
}
292292

‎src/node_process_methods.cc‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ static void ReallyExit(const FunctionCallbackInfo<Value>& args) {
501501
env->Exit(code);
502502
}
503503

504-
#ifdef__POSIX__
504+
#if defined __POSIX__ && !defined(__PASE__)
505505
inlineintpersist_standard_stream(int fd) {
506506
int flags = fcntl(fd, F_GETFD, 0);
507507

@@ -783,7 +783,7 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
783783
SetMethod(isolate, target, "dlopen", binding::DLOpen);
784784
SetMethod(isolate, target, "reallyExit", ReallyExit);
785785

786-
#ifdef__POSIX__
786+
#if defined __POSIX__ && !defined(__PASE__)
787787
SetMethod(isolate, target, "execve", Execve);
788788
#endif
789789
SetMethodNoSideEffect(isolate, target, "uptime", Uptime);
@@ -830,7 +830,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
830830
registry->Register(binding::DLOpen);
831831
registry->Register(ReallyExit);
832832

833-
#ifdef__POSIX__
833+
#if defined __POSIX__ && !defined(__PASE__)
834834
registry->Register(Execve);
835835
#endif
836836
registry->Register(Uptime);

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

Lines changed: 3 additions & 3 deletions
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-
}elseif(isWindows){
11-
skip('process.execve is not available in Windows');
10+
}elseif(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‎

Lines changed: 3 additions & 3 deletions
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-
}elseif(isWindows){
10-
skip('process.execve is not available in Windows');
9+
}elseif(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‎

Lines changed: 3 additions & 3 deletions
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-
}elseif(isWindows){
12-
skip('process.execve is not available in Windows');
11+
}elseif(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‎

Lines changed: 3 additions & 3 deletions
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-
}elseif(isWindows){
12-
skip('process.execve is not available in Windows');
11+
}elseif(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‎

Lines changed: 3 additions & 3 deletions
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-
}elseif(isWindows){
11-
skip('process.execve is not available in Windows');
10+
}elseif(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‎

Lines changed: 2 additions & 2 deletions
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‎

Lines changed: 3 additions & 3 deletions
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){

0 commit comments

Comments
 (0)