Update 28-tail.js

This commit is contained in:
realgnark 2022-01-13 17:36:24 +01:00 committed by GitHub
parent 8f634cff75
commit 0db4ab1fed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,8 @@ module.exports = function(RED) {
this.split = new RegExp(n.split.replace(/\\r/g,'\r').replace(/\\n/g,'\n').replace(/\\t/g,'\t') || "[\r]{0,1}\n");
var node = this;
node.tout = null;
var fileTail = function() {
if (fs.existsSync(node.filename)) {
if (node.filetype === "text") {
@ -54,14 +56,14 @@ module.exports = function(RED) {
};
var cancelRestart = function() {
if (node.tout) {
if (isRestartPending()) {
clearTimeout(node.tout);
node.tout = null;
}
};
var isRestartPending = function() {
return !!node.tout;
return node.tout !== null;
};
if (node.filename !== "") {