mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-26 07:05:52 -05:00
Fixed agent log parsing bug
This commit is contained in:
parent
8674f8eb02
commit
a5053b17e5
@ -109,10 +109,24 @@ function parseLine(entry)
|
|||||||
|
|
||||||
function readLog_data(buffer)
|
function readLog_data(buffer)
|
||||||
{
|
{
|
||||||
var lines = buffer.toString().split('\n');
|
var lines = buffer.toString();
|
||||||
while(lines.length > 0)
|
if (this.buffered != null) { lines = this.buffered + lines; }
|
||||||
|
lines = lines.split('\n');
|
||||||
|
var i;
|
||||||
|
|
||||||
|
for (i = 0; i < (lines.length - 1) ; ++i)
|
||||||
{
|
{
|
||||||
parseLine.call(this, lines.shift());
|
parseLine.call(this, lines[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lines.length == 1)
|
||||||
|
{
|
||||||
|
parseLine.call(this, lines[0]);
|
||||||
|
this.buffered = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.buffered = lines[lines.length - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,9 +136,11 @@ function readLogEx(path)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var s = require('fs').createReadStream(path);
|
var s = require('fs').createReadStream(path);
|
||||||
|
s.buffered = null;
|
||||||
s.results = ret;
|
s.results = ret;
|
||||||
s.on('data', readLog_data);
|
s.on('data', readLog_data);
|
||||||
s.resume();
|
s.resume();
|
||||||
|
if (s.buffered != null) { readLog_data.call(s, s.buffered); s.buffered = null; }
|
||||||
s.removeAllListeners('data');
|
s.removeAllListeners('data');
|
||||||
s = null;
|
s = null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user