Skip to content

Commit

Permalink
cli: refactor disconnect command processor
Browse files Browse the repository at this point in the history
PR-URL: #212
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
  • Loading branch information
belochub committed Jan 22, 2018
1 parent b8dcd3c commit d4b5821
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/cli/command-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ module.exports = class CommandProcessor extends EventEmitter {
}

disconnect(callback) {
if (this.cli.client) {
return this.cli.client.disconnect(() => {
this.cli.connection = null;
this.cli.client = null;
callback();
});
if (!this.cli.client) {
return callback(new Error('Not connected'));
}
callback(new Error('Not connected'));
this.cli.client.disconnect(() => {
this.cli.connection = null;
this.cli.client = null;
callback();
});
}

exit() {
Expand Down

0 comments on commit d4b5821

Please sign in to comment.