fix failing test
This commit is contained in:
parent
42d149e167
commit
d23c02371d
3 changed files with 14 additions and 2 deletions
|
@ -206,7 +206,7 @@ function emitNextRecord(opts, stylize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ready) {
|
if (!ready || minfile === undefined) {
|
||||||
for (ofile in streams) {
|
for (ofile in streams) {
|
||||||
if (!streams[ofile].stream || streams[ofile].done)
|
if (!streams[ofile].stream || streams[ofile].done)
|
||||||
continue;
|
continue;
|
||||||
|
@ -703,6 +703,7 @@ function processFile(file, opts, stylize, callback) {
|
||||||
streams[file].stream = stream;
|
streams[file].stream = stream;
|
||||||
|
|
||||||
stream.on('error', function (err) {
|
stream.on('error', function (err) {
|
||||||
|
streams[file].done = true;
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -726,11 +727,13 @@ function processFile(file, opts, stylize, callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
stream.on('end', function () {
|
stream.on('end', function () {
|
||||||
|
streams[file].done = true;
|
||||||
if (leftover) {
|
if (leftover) {
|
||||||
handleLogLine(file, leftover, opts, stylize);
|
handleLogLine(file, leftover, opts, stylize);
|
||||||
leftover = '';
|
leftover = '';
|
||||||
|
} else {
|
||||||
|
emitNextRecord(opts, stylize);
|
||||||
}
|
}
|
||||||
streams[file].done = true;
|
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
4
test/corpus/log1.log
Normal file
4
test/corpus/log1.log
Normal 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
5
test/corpus/log2.log
Normal 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}
|
Loading…
Reference in a new issue