From e62e8b88c2c113e9d61bbe59492e5b4015a4f6e5 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Thu, 12 Jul 2018 15:38:27 +0200 Subject: [PATCH] Simplify logs promises after review --- lib/actions/logs.coffee | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/actions/logs.coffee b/lib/actions/logs.coffee index a4192125..9afd197b 100644 --- a/lib/actions/logs.coffee +++ b/lib/actions/logs.coffee @@ -50,11 +50,12 @@ module.exports = timestamp = moment(line.timestamp).format('DD.MM.YY HH:mm:ss (ZZ)') console.log("#{timestamp} #{line.message}") - promise = if options.tail + if options.tail resin.logs.subscribe(params.uuid).then (logs) -> logs.on('line', printLine) logs.on('error', done) + .catch(done) else - resin.logs.history(params.uuid).each(printLine) - - promise.catch(done) + resin.logs.history(params.uuid) + .each(printLine) + .catch(done)