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;
nodeProcess.stderr.setEncoding('utf8');
var b = ''
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;

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

0 comments on commit 7c0f453

Please sign in to comment.