chore(debug): Expose debug port for spawned process (#1550) r=vladikoff

This commit is contained in:
Vijay Budhram 2016-11-22 13:12:00 -05:00 коммит произвёл Vlad Filippov
Родитель 70ff376d76
Коммит 767d53d3df
1 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -17,6 +17,13 @@ let currentServer
function TestServer(config, printLogs) {
currentServer = this
if (printLogs === undefined) {
// Issue where debugger does not attach if
// child process output is not piped to console
if (isDebug()) {
process.env.REMOTE_TEST_LOGS = 'true'
}
printLogs = (process.env.REMOTE_TEST_LOGS === 'true')
}
this.printLogs = printLogs
@ -84,10 +91,21 @@ TestServer.start = function (config, printLogs) {
return d.promise
}
function isDebug(){
return global.v8debug ? true : false
}
TestServer.prototype.start = function () {
var spawnOptions = ['./key_server_stub.js']
var nextDebugPort = process.debugPort + 2
if (isDebug()) {
spawnOptions.unshift('--debug-brk=' + nextDebugPort)
}
this.server = cp.spawn(
'node',
['./key_server_stub.js'],
spawnOptions,
{
cwd: __dirname,
stdio: this.printLogs ? 'pipe' : 'ignore'