1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Added a bit more error cathing to tail node

This commit is contained in:
Dave C-J 2013-10-19 14:58:05 +01:00
parent b1c9e95209
commit 547ae0cd72

View File

@ -25,6 +25,7 @@ function TailNode(n) {
this.split = n.split; this.split = n.split;
var node = this; var node = this;
var err = "";
var tail = spawn("tail", ["-f", this.filename]); var tail = spawn("tail", ["-f", this.filename]);
tail.stdout.on("data", function (data) { tail.stdout.on("data", function (data) {
var msg = {topic:node.filename}; 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() { this.on("close", function() {
tail.kill(); if (tail) tail.kill();
}); });
} }