Skip to content

Commit

Permalink
add timeout to check for heroku login status correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
atomfrede committed Sep 15, 2021
1 parent 67d5308 commit 99a2b12
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions generators/heroku/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ module.exports = class extends BaseBlueprintGenerator {
const regionParams = this.herokuRegion !== 'us' ? ` --region ${this.herokuRegion}` : '';

this.log(chalk.bold('\nCreating Heroku application and setting up node environment'));
const child = ChildProcess.exec(`heroku create ${this.herokuAppName}${regionParams}`, (err, stdout, stderr) => {
const child = ChildProcess.exec(`heroku create ${this.herokuAppName}${regionParams}`, { timeout: 6000 }, (err, stdout, stderr) => {
if (err) {
if (stderr.includes('is already taken')) {
const prompts = [
Expand Down Expand Up @@ -460,7 +460,11 @@ module.exports = class extends BaseBlueprintGenerator {
});
} else {
this.abort = true;
this.log.error(err);
if (stderr.includes('Invalid credentials')) {
this.log.error("Error: Not authenticated. Run 'heroku login' to login to your heroku account and try again.");
} else {
this.log.error(err);
}
done();
}
} else {
Expand Down

0 comments on commit 99a2b12

Please sign in to comment.