Add delay into test-debugger-client

This commit is contained in:
Ryan Dahl 2011-01-11 16:30:01 -08:00
parent 8e461673c4
commit 7c0f453b7c

View File

@ -126,10 +126,13 @@ 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;
setTimeout(function() {
// Wait for some data before trying to connect // Wait for some data before trying to connect
var c = new debug.Client(); var c = new debug.Client();
process.stdout.write(">>> connecting..."); process.stdout.write(">>> connecting...");
@ -143,6 +146,7 @@ function doTest(cb, done) {
done(); done();
}); });
}); });
}, 100);
} }
}); });
} }