Skip to content

Commit

Permalink
Fix early exit double-printing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
taylortom authored Nov 20, 2024
1 parent f9cb072 commit 56c19bc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/CliCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,18 @@ export default class CliCommand {
message: 'Choose a release',
choices: this.options.releaseData.releases.map(r => { return { title: r.name, value: r } })
}])
if (release.branch || release.draft || release.prerelease) {
if (release && (release.branch || release.draft || release.prerelease)) {
const { confirmed } = await this.getInput([{
type: 'confirm',
name: 'confirmed',
message: 'Would you like to continue?',
initial: false
}], 'WARNING! YOU HAVE CHOSEN TO INSTALL A NON-STABLE VERSION WHICH IS NOT SUITABLE FOR PRODUCTION. PLEASE PROCEED WITH CAUTION.')
console.log('\n')
if (!confirmed) {
console.log('\nGoodbye.')
this.cleanUp(new Error('User cancelled install'))
}
if(confirmed) return release.tag_name
}
return release.tag_name
console.log('\nGoodbye.')
this.cleanUp(new Error('User cancelled install'))
}

async getInput (configs, message) {
Expand Down Expand Up @@ -122,5 +120,6 @@ export default class CliCommand {
}
console.log('Goodbye!')
process.exitCode = error ? 1 : 0
process.exit()
}
}

0 comments on commit 56c19bc

Please sign in to comment.