diff --git a/lib/tail.js b/lib/tail.js index de135bd..635bcd2 100644 --- a/lib/tail.js +++ b/lib/tail.js @@ -20,14 +20,10 @@ var Tail = function (path, options) { tail = spawn('tail', ['-n', options.buffer, '-F', path]); } - tail.on('close', function () { - //kill the process if the tail is closed - process.exit(); - }); - tail.stderr.on('data', function (data) { - //if there is any error then display it in the console. + //if there is any error then display it in the console and then kill the tail. console.error(data.toString()); + process.exit(); }); tail.stdout.on('data', function (data) {