GeezerVison is showing github.com — process: make execve's args argument optional · nodejs/node@74e1aa4
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/process/per_thread.js +1-1Lines changed: 1 addition & 1 deletion | 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'); |
|
Collapse file
Copy file name to clipboardExpand all lines: node.gyp +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
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', |
|
Collapse file
Copy file name to clipboard +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +int main(void) { |
| 2 | + return 0; |
| 3 | +} |
Collapse file
Copy file name to clipboard +25Lines changed: 25 additions & 0 deletions | 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'); |