Skip to content

Commit 248c938

Browse files
abmusseaduh95
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 581439c commit 248c938

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
@@ -3347,7 +3347,7 @@ any exit or close events and without running any cleanup handler.
33473347
33483348
This function will never return, unless an error occurred.
33493349
3350-
This function is not available on Windows.
3350+
This function is not available on Windows or IBM i.
33513351
33523352
## `process.report`
33533353

‎lib/internal/process/per_thread.js‎

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

245245
if(!isMainThread){
246246
thrownewERR_WORKER_UNSUPPORTED_OPERATION('Calling process.execve');
247-
}elseif(process.platform==='win32'){
247+
}elseif(process.platform==='win32'||process.platform==='os400'){
248248
thrownewERR_FEATURE_UNAVAILABLE_ON_PLATFORM('process.execve');
249249
}
250250

‎src/node_process_methods.cc‎

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

480-
#ifdef__POSIX__
480+
#if defined __POSIX__ && !defined(__PASE__)
481481
inlineintpersist_standard_stream(int fd) {
482482
int flags = fcntl(fd, F_GETFD, 0);
483483

@@ -758,7 +758,7 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
758758
SetMethod(isolate, target, "dlopen", binding::DLOpen);
759759
SetMethod(isolate, target, "reallyExit", ReallyExit);
760760

761-
#ifdef__POSIX__
761+
#if defined __POSIX__ && !defined(__PASE__)
762762
SetMethod(isolate, target, "execve", Execve);
763763
#endif
764764
SetMethodNoSideEffect(isolate, target, "uptime", Uptime);
@@ -804,7 +804,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
804804
registry->Register(binding::DLOpen);
805805
registry->Register(ReallyExit);
806806

807-
#ifdef__POSIX__
807+
#if defined __POSIX__ && !defined(__PASE__)
808808
registry->Register(Execve);
809809
#endif
810810
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)