Skip to content

Commit

Permalink
fixup: cjihrig comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Nov 4, 2015
1 parent 8076de4 commit 6cc5743
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/_debug_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,25 @@ const Buffer = require('buffer').Buffer;
const Transform = require('stream').Transform;

exports.start = function start() {
var agent = new Agent();
const agent = new Agent();

// SmartOS sometimes munges output from `process._rawDebug()`
// but Windows can't use `console.error()`.
// https://github.com/nodejs/node/issues/2476
const log = process.platform === 'win32' ? process._rawDebug : console.error;

// Do not let `agent.listen()` request listening from cluster master
const cluster = require('cluster');
cluster.isWorker = false;
cluster.isMaster = true;

agent.on('error', function(err) {
process._rawDebug(err.stack || err);
log(err.stack || err);
});

agent.listen(process._debugAPI.port, function() {
var addr = this.address();
// SmartOS sometimes munges output from `process._rawDebug()`
// but Windows can't use `console.error()`.
// https://github.com/nodejs/node/issues/2476
if (process.platform == 'win32') {
process._rawDebug('Debugger listening on port %d', addr.port);
} else {
console.error('Debugger listening on port %d', addr.port);
}
const addr = this.address();
log(`Debugger listening on port ${addr.port}`);
process._debugAPI.notifyListen();
});

Expand Down

0 comments on commit 6cc5743

Please sign in to comment.