Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/commands/login/login.command.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,17 @@ async function loginViaConsole(apiHost, consoleTokenUrl) {

Logger.debug('Try to login to Clever Cloud…');
Logger.println(`Opening ${styleText('blue', consoleUrl.toString())} in your browser to log you in…`);
await open(consoleUrl.toString(), { wait: false });
function warnBrowserLaunchFailed(error) {
Logger.warn(`Failed to open your browser automatically (${error.message}).`);
Logger.println('Open the URL above manually to continue logging in.');
}

try {
const browserProcess = await open(consoleUrl.toString(), { wait: false });
browserProcess.once('error', warnBrowserLaunchFailed);
} catch (error) {
warnBrowserLaunchFailed(error);
}

return pollOauthData(cliPollUrl.toString());
}
Expand Down