mirror of https://github.com/node-red/node-red.git
Added a bit more error cathing to tail node
parent
b1c9e95209
commit
547ae0cd72
|
@ -25,6 +25,7 @@ function TailNode(n) {
|
|||
this.split = n.split;
|
||||
var node = this;
|
||||
|
||||
var err = "";
|
||||
var tail = spawn("tail", ["-f", this.filename]);
|
||||
tail.stdout.on("data", function (data) {
|
||||
var msg = {topic:node.filename};
|
||||
|
@ -43,8 +44,12 @@ function TailNode(n) {
|
|||
}
|
||||
});
|
||||
|
||||
tail.stderr.on("data", function(data) {
|
||||
node.warn(data.toString());
|
||||
});
|
||||
|
||||
this.on("close", function() {
|
||||
tail.kill();
|
||||
if (tail) tail.kill();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue