Debugger client emits ready after recving initial res
This commit is contained in:
parent
a8417c128e
commit
4e81cf7def
@ -19,7 +19,8 @@ function tryConnect() {
|
||||
c = new Client();
|
||||
|
||||
process.stdout.write("connecting...");
|
||||
c.connect(exports.port, function () {
|
||||
c.connect(exports.port);
|
||||
c.on('ready', function () {
|
||||
process.stdout.write("ok\r\n");
|
||||
startInterface();
|
||||
});
|
||||
@ -141,6 +142,7 @@ Client.prototype._onResponse = function(res) {
|
||||
|
||||
if (res.headers.Type == 'connect') {
|
||||
// do nothing
|
||||
this.emit('ready');
|
||||
} else if (cb) {
|
||||
this._reqCallbacks.splice(i, 1);
|
||||
cb(res.body);
|
||||
|
@ -65,7 +65,7 @@ var connectCount = 0;
|
||||
|
||||
function doTest(cb, done) {
|
||||
var nodeProcess = spawn(process.execPath,
|
||||
['-e', 'setInterval(function () { console.log("blah"); }, 1000);']);
|
||||
['-e', 'setInterval(function () { console.log("blah"); }, 100);']);
|
||||
|
||||
nodeProcess.stdout.once('data', function () {
|
||||
console.log(">>> new node process: %d", nodeProcess.pid);
|
||||
@ -82,9 +82,10 @@ function doTest(cb, done) {
|
||||
// Wait for some data before trying to connect
|
||||
var c = new debug.Client();
|
||||
process.stdout.write(">>> connecting...");
|
||||
c.connect(debug.port, function () {
|
||||
c.connect(debug.port)
|
||||
c.on('ready', function () {
|
||||
connectCount++;
|
||||
console.log("connected!");
|
||||
console.log("ready!");
|
||||
cb(c, function () {
|
||||
console.error(">>> killing node process %d\n\n", nodeProcess.pid);
|
||||
nodeProcess.kill();
|
||||
|
Loading…
x
Reference in New Issue
Block a user