diff --git a/src/commands/asa/connect.ts b/src/commands/asa/connect.ts index 7206e39..4a693e1 100644 --- a/src/commands/asa/connect.ts +++ b/src/commands/asa/connect.ts @@ -25,7 +25,7 @@ export default class AsaConnect extends Command { this.log('The link is valid for one hour. Sign in to the Adapty dashboard in that browser first — the last') this.log('step is authorized by the dashboard session, not by this CLI.') - await open(authUrl).catch(() => false) + if (process.stdin.isTTY === true) await open(authUrl).catch(() => false) if (!flags.wait) return {auth_url: authUrl} diff --git a/src/commands/auth/login.ts b/src/commands/auth/login.ts index 6d37f8b..297ee3a 100644 --- a/src/commands/auth/login.ts +++ b/src/commands/auth/login.ts @@ -56,10 +56,12 @@ static examples = ['<%= config.bin %> auth login'] this.log(`\nYour code: ${device.user_code}\n`) this.log(`If browser doesn't open, visit: ${device.verification_uri_complete}\n`) - try { - await open(device.verification_uri_complete) - } catch { - // browser open failed silently — URL already printed + if (process.stdin.isTTY === true) { + try { + await open(device.verification_uri_complete) + } catch { + // browser open failed silently — URL already printed + } } this.log('Waiting for authorization...')