From eb729d149e933ef3e9f3667a9da7ff9d062e5f08 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Thu, 5 Oct 2017 12:49:06 +0200 Subject: [PATCH 1/2] Ensure analytics failures (e.g. from broken tokens) at startup don't break commands Change-Type: patch --- build/app.js | 10 ++++++---- build/events.js | 4 ++-- lib/app.coffee | 9 ++++++--- lib/events.coffee | 4 +++- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/build/app.js b/build/app.js index 769bf445..151dc430 100644 --- a/build/app.js +++ b/build/app.js @@ -230,15 +230,17 @@ capitano.command(actions.deploy); update.notify(); plugins.register(/^resin-plugin-(.+)$/).then(function() { - var cli; + var cli, runCommand; cli = capitano.parse(process.argv); - return events.trackCommand(cli).then(function() { + runCommand = function() { var ref, ref1; if ((ref = cli.global) != null ? ref.help : void 0) { return capitanoExecuteAsync({ command: "help " + ((ref1 = cli.command) != null ? ref1 : '') }); + } else { + return capitanoExecuteAsync(cli); } - return capitanoExecuteAsync(cli); - }); + }; + return Promise.all([events.trackCommand(cli), runCommand()]); })["catch"](errors.handle); diff --git a/build/events.js b/build/events.js index 26731646..1f6b0dfe 100644 --- a/build/events.js +++ b/build/events.js @@ -22,7 +22,7 @@ exports.trackCommand = function(capitanoCommand) { capitanoStateGetMatchCommandAsync = Promise.promisify(require('capitano').state.getMatchCommand); return Promise.props({ resinUrl: resin.settings.get('resinUrl'), - username: resin.auth.whoami(), + username: resin.auth.whoami().catchReturn(void 0), mixpanel: exports.getLoggerInstance() }).then(function(arg) { var mixpanel, resinUrl, username; @@ -45,5 +45,5 @@ exports.trackCommand = function(capitanoCommand) { command: capitanoCommand }); }); - }); + }).timeout(100).catchReturn(); }; diff --git a/lib/app.coffee b/lib/app.coffee index a3026e9f..643c3c73 100644 --- a/lib/app.coffee +++ b/lib/app.coffee @@ -203,9 +203,12 @@ update.notify() plugins.register(/^resin-plugin-(.+)$/).then -> cli = capitano.parse(process.argv) - events.trackCommand(cli).then -> + runCommand = -> if cli.global?.help - return capitanoExecuteAsync(command: "help #{cli.command ? ''}") - capitanoExecuteAsync(cli) + capitanoExecuteAsync(command: "help #{cli.command ? ''}") + else + capitanoExecuteAsync(cli) + + Promise.all([events.trackCommand(cli), runCommand()]) .catch(errors.handle) diff --git a/lib/events.coffee b/lib/events.coffee index 57de2c87..54b6e6be 100644 --- a/lib/events.coffee +++ b/lib/events.coffee @@ -13,7 +13,7 @@ exports.trackCommand = (capitanoCommand) -> return Promise.props resinUrl: resin.settings.get('resinUrl') - username: resin.auth.whoami() + username: resin.auth.whoami().catchReturn(undefined) mixpanel: exports.getLoggerInstance() .then ({ username, resinUrl, mixpanel }) -> return capitanoStateGetMatchCommandAsync(capitanoCommand.command).then (command) -> @@ -30,3 +30,5 @@ exports.trackCommand = (capitanoCommand) -> resinUrl: resinUrl platform: process.platform command: capitanoCommand + .timeout(100) + .catchReturn() From f7c025814589c9cdbdd3f0bd05c81980a5d6a13d Mon Sep 17 00:00:00 2001 From: "resin-io-versionbot[bot]" Date: Fri, 6 Oct 2017 07:42:39 +0000 Subject: [PATCH 2/2] v6.6.8 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca616cb7..88af38eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! This project adheres to [Semantic Versioning](http://semver.org/). +## v6.6.8 - 2017-10-06 + +* Ensure analytics failures (e.g. from broken tokens) at startup don't break commands #675 [Tim Perry] + ## v6.6.7 - 2017-09-22 * Update to resin-sync, which fixes local push on windows #666 [Tim Perry] diff --git a/package.json b/package.json index 2f93b946..2c5a14ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "resin-cli", - "version": "6.6.7", + "version": "6.6.8", "description": "The official resin.io CLI tool", "main": "./build/actions/index.js", "homepage": "https://github.com/resin-io/resin-cli",