Merge pull request #148 from resin-io/jviotti/fix/14/logs-history

Force logs command to exit when not in --tail mode. Fix #14.
This commit is contained in:
Juan Cruz Viotti 2015-08-14 07:58:05 -04:00
commit abf5740950
2 changed files with 9 additions and 2 deletions

View File

@ -24,7 +24,9 @@
return console.log(line.message);
});
if (!options.tail) {
return promise.nodeify(done);
return promise["catch"](done)["finally"](function() {
return process.exit(0);
});
}
return promise.then(function() {
return resin.logs.subscribe(params.uuid).then(function(logs) {

View File

@ -34,7 +34,12 @@ module.exports =
console.log(line.message)
if not options.tail
return promise.nodeify(done)
# PubNub keeps the process alive after a history query.
# Until this is fixed, we force the process to exit.
# This of course prevents this command to be used programatically
return promise.catch(done).finally ->
process.exit(0)
promise.then ->
resin.logs.subscribe(params.uuid).then (logs) ->