diff --git a/lib/_debugger.js b/lib/_debugger.js index 382afd18cdb..12f67a75188 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -7,8 +7,13 @@ exports.port = 5858; exports.start = function () { startInterface(); + + process.on('exit', function () { + if (child) child.kill(); + }); }; +var child; var c; var term; @@ -18,13 +23,11 @@ function trySpawn(cb) { console.log(args); - var child = spawn(process.execPath, args, { - customFds: [0, 1, 2] - }); + child = spawn(process.execPath, args, { customFds: [0, 1, 2] }); setTimeout(function () { tryConnect(cb); - }, 1000); + }, 100); } function tryConnect(cb) { @@ -384,7 +387,11 @@ function startInterface() { tryQuit(); } else if (/^r(un)?/.test(cmd)) { - trySpawn(); + trySpawn(function () { + c.reqContinue(function (res) { + // Wait for break point. (disable raw mode?) + }); + }); } else if (/^help/.test(cmd)) { console.log(helpMessage);