-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cluster: do not unconditionally set --debug-port #1949
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const cluster = require('cluster'); | ||
|
||
if (cluster.isMaster) { | ||
assert.strictEqual(process.execArgv.length, 0, 'run test with no args'); | ||
|
||
function checkExitCode(code, signal) { | ||
assert.strictEqual(code, 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add |
||
assert.strictEqual(signal, null); | ||
} | ||
|
||
console.log('forked worker should not have --debug-port'); | ||
cluster.fork().on('exit', checkExitCode); | ||
|
||
cluster.setupMaster({ | ||
execArgv: ['--debug-port=' + process.debugPort] | ||
}); | ||
|
||
console.log('forked worker should have --debug-port, with offset = 1'); | ||
cluster.fork({ | ||
portSet: process.debugPort + 1 | ||
}).on('exit', checkExitCode); | ||
|
||
console.log('forked worker should have --debug-port, with offset = 2'); | ||
cluster.fork({ | ||
portSet: process.debugPort + 2 | ||
}).on('exit', checkExitCode); | ||
} else { | ||
const hasDebugArg = process.execArgv.some(function(arg) { | ||
return /debug/.test(arg); | ||
}); | ||
|
||
assert.strictEqual(hasDebugArg, process.env.portSet !== undefined); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we really do this check? We are using a default value anyway in the next test right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we should do this check to make sure that a debug argument is not always passed to the worker. |
||
assert.strictEqual(process.debugPort, +process.env.portSet || 5858); | ||
process.exit(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no any range checking. I still think we need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not really the point of this PR. There have been a few other PRs that have attempted to add checking, and they are still open.