| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4e54dbe commit e888471
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,6 +32,16 @@ exports.fork = function(modulePath /*, args, options*/) { | |||
| 32 | 32 | ||
| 33 | 33 | // Prepare arguments for fork: | |
| 34 | 34 | execArgv = options.execArgv || process.execArgv; | |
| 35 | + | ||
| 36 | + if (execArgv === process.execArgv && process._eval != null) { | ||
| 37 | + const index = execArgv.lastIndexOf(process._eval); | ||
| 38 | + if (index > 0) { | ||
| 39 | + // Remove the -e switch to avoid fork bombing ourselves. | ||
| 40 | + execArgv = execArgv.slice(); | ||
| 41 | + execArgv.splice(index - 1, 2); | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + | ||
| 35 | 45 | args = execArgv.concat([modulePath], args); | |
| 36 | 46 | ||
| 37 | 47 | // Leave stdin open for the IPC channel. stdout and stderr should be the | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ if (module.parent) { | |||
| 8 | 8 | var common = require('../common'), | |
| 9 | 9 | assert = require('assert'), | |
| 10 | 10 | child = require('child_process'), | |
| 11 | + path = require('path'), | ||
| 11 | 12 | nodejs = '"' + process.execPath + '"'; | |
| 12 | 13 | ||
| 13 | 14 | ||
@@ -75,3 +76,11 @@ child.exec(nodejs + ' --use-strict -p process.execArgv', | |||
| 75 | 76 | function(status, stdout, stderr) { | |
| 76 | 77 | assert.equal(stdout, "[ '--use-strict', '-p', 'process.execArgv' ]\n"); | |
| 77 | 78 | }); | |
| 79 | + | ||
| 80 | + // Regression test for https://github.com/nodejs/node/issues/3574 | ||
| 81 | + const emptyFile = path.join(common.fixturesDir, 'empty.js'); | ||
| 82 | + child.exec(nodejs + ` -e 'require("child_process").fork("${emptyFile}")'`, | ||
| 83 | + function(status, stdout, stderr) { | ||
| 84 | + assert.equal(stdout, ''); | ||
| 85 | + assert.equal(stderr, ''); | ||
| 86 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments