simplify error catching

pull/39/head
rcatoio 2015-02-04 17:13:34 +01:00
parent 82618c8cc9
commit 2bfb6b1c51
1 changed files with 2 additions and 6 deletions

View File

@ -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) {