Skip to content
Browse files

Fixed args passing while tailing multiple files. fixes #4

  • Loading branch information...
1 parent 9885e9f commit 42b6ff627992836f2bdd6b2cacaa38dcee7e401b @mthenw committed May 6, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/frontail.js
View
8 lib/frontail.js
@@ -28,7 +28,7 @@ if (program.args.length === 0) {
console.error('Arguments needed, use --help');
process.exit();
} else {
- var files = program.args.join(" ");
+ var files = program.args;
}
if (program.daemonize) {
@@ -52,7 +52,7 @@ var server = http.createServer(function (req, res) {
res.end('Interal error');
} else {
res.writeHead(200, {'Content-Type': 'text/html'});
- res.end(data.toString('utf-8').replace(/__TITLE__/g, 'tail -F ' + files), 'utf-8');
+ res.end(data.toString('utf-8').replace(/__TITLE__/g, 'tail -F ' + files.join(' ')), 'utf-8');
}
});
});
@@ -71,7 +71,7 @@ var io = socketio.listen(server, {
*/
io.sockets.on('connection', function (socket) {
- var tail = spawn('tail', ['-n', program.number, files]);
+ var tail = spawn('tail', ['-n', program.number].concat(files));
tail.stdout.on('data', function (data) {
socket.emit('lines', data.toString('utf-8').split('\n'));
});
@@ -81,7 +81,7 @@ io.sockets.on('connection', function (socket) {
* Send incoming data
*/
-var tail = spawn('tail', ['-F', files]);
+var tail = spawn('tail', ['-F'].concat(files));
tail.stdout.on('data', function (data) {
io.sockets.emit('lines', data.toString('utf-8').split('\n'));
});

0 comments on commit 42b6ff6

Please sign in to comment.
Something went wrong with that request. Please try again.