Skip to content

Commit c3a3f01

Browse files
committed
fix: show url when HEROKU_TESTING_HEADLESS_LOGIN is set
1 parent ea84f0c commit c3a3f01

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/login.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,10 @@ export class Login {
151151
const url = `${this.loginHost}${urls.browser_url}`
152152
const cp = await opn(url, {wait: false})
153153
cp.on('error', ux.error)
154+
const showUrl = () => ux.warn(`Cannot open browser. Go to ${color.greenBright(url)} to finish login or run ${color.cmd('heroku login --interactive')}\n`)
155+
if (process.env.HEROKU_TESTING_HEADLESS_LOGIN === '1') showUrl()
154156
cp.on('close', code => {
155-
if (code === 0) return
156-
process.stderr.write(`Cannot open browser. Go to ${color.greenBright(url)} to finish login or run ${color.cmd('heroku login --interactive')}\n`)
157+
if (code !== 0) showUrl()
157158
})
158159
ux.action.start('Waiting for login')
159160
const {body: auth} = await HTTP.get(`${this.loginHost}${urls.cli_url}`, {

0 commit comments

Comments
 (0)