| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1b9b5bd commit 74e1aa4
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -237,7 +237,7 @@ function wrapProcessMethods(binding) { | |||
| 237 | 237 | return true; | |
| 238 | 238 | } | |
| 239 | 239 | ||
| 240 | - function execve(execPath, args, env) { | ||
| 240 | + function execve(execPath, args = [], env) { | ||
| 241 | 241 | emitExperimentalWarning('process.execve'); | |
| 242 | 242 | ||
| 243 | 243 | const { isMainThread } = require('internal/worker'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1336,6 +1336,13 @@ | |||
| 1336 | 1336 | }], | |
| 1337 | 1337 | ] | |
| 1338 | 1338 | }, # overlapped-checker | |
| 1339 | + { | ||
| 1340 | + 'target_name': 'nop', | ||
| 1341 | + 'type': 'executable', | ||
| 1342 | + 'sources': [ | ||
| 1343 | + 'test/nop/nop.c', | ||
| 1344 | + ] | ||
| 1345 | + }, # nop | ||
| 1339 | 1346 | { | |
| 1340 | 1347 | 'target_name': 'node_js2c', | |
| 1341 | 1348 | 'type': 'executable', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + int main(void) { | ||
| 2 | + return 0; | ||
| 3 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,25 @@ | |||
| 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'); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments