File tree Expand file tree Collapse file tree 4 files changed +36
-1
lines changed Expand file tree Collapse file tree 4 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -279,7 +279,7 @@ function wrapProcessMethods(binding) {
279279 return true ;
280280 }
281281
282- function execve ( execPath , args , env ) {
282+ function execve ( execPath , args = [ ] , env ) {
283283 emitExperimentalWarning ( 'process.execve' ) ;
284284
285285 const { isMainThread } = require ( 'internal/worker' ) ;
Original file line number Diff line number Diff line change 13321332 }],
13331333 ]
13341334 }, # overlapped-checker
1335+ {
1336+ 'target_name' : 'nop' ,
1337+ 'type' : 'executable' ,
1338+ 'sources' : [
1339+ 'test/nop/nop.c' ,
1340+ ]
1341+ }, # nop
13351342 {
13361343 'target_name' : 'node_js2c' ,
13371344 'type' : 'executable' ,
Original file line number Diff line number Diff line change 1+ int main (void ) {
2+ return 0 ;
3+ }
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const { skip, isWindows, isIBMi } = require ( '../common' ) ;
4+ const { fail } = require ( 'assert' ) ;
5+ const { isMainThread } = require ( 'worker_threads' ) ;
6+ const { dirname, join } = require ( 'path' ) ;
7+ const { existsSync } = require ( 'fs' ) ;
8+
9+ if ( ! isMainThread ) {
10+ skip ( 'process.execve is not available in Workers' ) ;
11+ } else if ( isWindows || isIBMi ) {
12+ skip ( 'process.execve is not available in Windows or IBM i' ) ;
13+ }
14+
15+ // Get full path to the executable used for the test
16+ const executable = join ( dirname ( process . execPath ) , 'nop' ) ;
17+
18+ // Sanity check that the binary exists
19+ if ( ! existsSync ( executable ) ) {
20+ skip ( executable + ' binary is not available' ) ;
21+ }
22+
23+ process . execve ( executable ) ;
24+ // If process.execve succeeds, this should never be executed.
25+ fail ( 'process.execve failed' ) ;
You can’t perform that action at this time.
0 commit comments