Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Add delay into test-debugger-client
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Jan 12, 2011
1 parent 8e46167 commit 7c0f453
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions test/simple/test-debugger-client.js
Expand Up @@ -126,23 +126,27 @@ function doTest(cb, done) {


var didTryConnect = false; var didTryConnect = false;
nodeProcess.stderr.setEncoding('utf8'); nodeProcess.stderr.setEncoding('utf8');
var b = ''
nodeProcess.stderr.on('data', function (data) { nodeProcess.stderr.on('data', function (data) {
if (didTryConnect == false && /debugger/.test(data)) { b += data;
if (didTryConnect == false && /debugger listening on port/.test(b)) {
didTryConnect = true; didTryConnect = true;


// Wait for some data before trying to connect setTimeout(function() {
var c = new debug.Client(); // Wait for some data before trying to connect
process.stdout.write(">>> connecting..."); var c = new debug.Client();
c.connect(debug.port) process.stdout.write(">>> connecting...");
c.on('ready', function () { c.connect(debug.port)
connectCount++; c.on('ready', function () {
console.log("ready!"); connectCount++;
cb(c, function () { console.log("ready!");
console.error(">>> killing node process %d\n\n", nodeProcess.pid); cb(c, function () {
nodeProcess.kill(); console.error(">>> killing node process %d\n\n", nodeProcess.pid);
done(); nodeProcess.kill();
done();
});
}); });
}); }, 100);
} }
}); });
} }
Expand Down

0 comments on commit 7c0f453

Please sign in to comment.