diff --git a/src/commands/force/org/open.ts b/src/commands/force/org/open.ts index f4bce184..57667817 100644 --- a/src/commands/force/org/open.ts +++ b/src/commands/force/org/open.ts @@ -9,7 +9,7 @@ import { URL } from 'url'; import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command'; import { Messages, Org, MyDomainResolver, SfdxError, sfdc } from '@salesforce/core'; -import { Env, toNumber, Duration } from '@salesforce/kit'; +import { Env, Duration } from '@salesforce/kit'; import { openUrl } from '../../../shared/utils'; Messages.importMessagesDirectory(__dirname); @@ -39,7 +39,7 @@ export class OrgOpenCommand extends SfdxCommand { const username = this.org.getUsername(); const output = { orgId, url, username }; - if (new Env().getString('SFDX_CONTAINER_MODE') ? true : false) { + if (new Env().getBoolean('SFDX_CONTAINER_MODE')) { // instruct the user that they need to paste the URL into the browser this.ux.styledHeader('Action Required!'); this.ux.log(messages.getMessage('containerAction', [orgId, url])); @@ -62,14 +62,13 @@ export class OrgOpenCommand extends SfdxCommand { const conn = this.org.getConnection(); const accessToken = conn.accessToken; const instanceUrl = this.org.getField(Org.Fields.INSTANCE_URL) as string; - const instanceUrlClean = instanceUrl.endsWith('/') ? instanceUrl.substr(0, instanceUrl.length) : instanceUrl; - + const instanceUrlClean = instanceUrl.replace(/\/$/, ''); return `${instanceUrlClean}/secur/frontdoor.jsp?sid=${accessToken}`; } private async checkLightningDomain(url: string): Promise { const domain = `https://${/https?:\/\/([^.]*)/.exec(url)[1]}.lightning.force.com`; - const timeout = new Duration(toNumber(new Env().getString('SFDX_DOMAIN_RETRY', '240')), Duration.Unit.SECONDS); + const timeout = new Duration(new Env().getNumber('SFDX_DOMAIN_RETRY', 240), Duration.Unit.SECONDS); if (sfdc.isInternalUrl(domain) || timeout.seconds === 0) { return; } diff --git a/src/shared/utils.ts b/src/shared/utils.ts index b095bfdc..6c90dbd2 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -22,5 +22,5 @@ export const camelCaseToTitleCase = (text: string): string => { }; export const openUrl = async (url: string): Promise => { - return open(url, { wait: false }); + return open(url); }; diff --git a/test/commands/force/org/list.test.ts b/test/commands/force/org/list.test.ts index df5324ae..2b204ad9 100644 --- a/test/commands/force/org/list.test.ts +++ b/test/commands/force/org/list.test.ts @@ -1,9 +1,3 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ /* * Copyright (c) 2020, salesforce.com, inc. * All rights reserved.