mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-30 16:13:59 +00:00
Ensure analytics failures (e.g. from broken tokens) at startup don't break commands
Change-Type: patch
This commit is contained in:
parent
39ac28d4ef
commit
eb729d149e
10
build/app.js
10
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 Promise.all([events.trackCommand(cli), runCommand()]);
|
||||
})["catch"](errors.handle);
|
||||
|
@ -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();
|
||||
};
|
||||
|
@ -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(command: "help #{cli.command ? ''}")
|
||||
else
|
||||
capitanoExecuteAsync(cli)
|
||||
|
||||
Promise.all([events.trackCommand(cli), runCommand()])
|
||||
|
||||
.catch(errors.handle)
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user