fix failing test

This commit is contained in:
Dave Pacheco 2012-06-21 13:29:42 -07:00
parent 42d149e167
commit d23c02371d
3 changed files with 14 additions and 2 deletions

View file

@ -206,7 +206,7 @@ function emitNextRecord(opts, stylize)
}
}
if (!ready) {
if (!ready || minfile === undefined) {
for (ofile in streams) {
if (!streams[ofile].stream || streams[ofile].done)
continue;
@ -703,6 +703,7 @@ function processFile(file, opts, stylize, callback) {
streams[file].stream = stream;
stream.on('error', function (err) {
streams[file].done = true;
callback(err);
});
@ -726,11 +727,13 @@ function processFile(file, opts, stylize, callback) {
});
stream.on('end', function () {
streams[file].done = true;
if (leftover) {
handleLogLine(file, leftover, opts, stylize);
leftover = '';
} else {
emitNextRecord(opts, stylize);
}
streams[file].done = true;
callback();
});
}

4
test/corpus/log1.log Normal file
View file

@ -0,0 +1,4 @@
{"name":"agent1","pid":73267,"hostname":"headnode","level":30,"msg":"message","time":"2012-05-08T16:57:55.586Z","v":0}
{"name":"agent1","pid":73267,"hostname":"headnode","level":30,"msg":"message","time":"2012-05-08T17:02:49.339Z","v":0}
{"name":"agent1","pid":73267,"hostname":"headnode","level":30,"msg":"message","time":"2012-05-08T17:02:49.404Z","v":0}
{"name":"agent1","pid":73267,"hostname":"headnode","level":30,"msg":"message","time":"2012-05-08T17:02:49.404Z","v":0}

5
test/corpus/log2.log Normal file
View file

@ -0,0 +1,5 @@
{"name":"agent2","pid":73267,"hostname":"headnode","level":30,"msg":"message","time":"2012-05-08T16:58:55.586Z","v":0}
{"name":"agent2","pid":73267,"hostname":"headnode","level":30,"msg":"message","time":"2012-05-08T17:01:49.339Z","v":0}
{"name":"agent2","pid":73267,"hostname":"headnode","level":30,"msg":"message","time":"2012-05-08T17:02:47.404Z","v":0}
{"name":"agent2","pid":73267,"hostname":"headnode","level":30,"msg":"message","time":"2012-05-08T17:02:57.404Z","v":0}
{"name":"agent2","pid":76156,"hostname":"headnode","level":30,"msg":"message","time":"2012-05-08T17:08:01.105Z","v":0}