@@ -293,7 +293,11 @@ export class AppUtils {
293293 return this . _parseForceOrgDisplayResult ( response . cliCommand , response . commandOutput ) ;
294294 }
295295 let response = await AppUtils . execSfdxCommand ( "force:org:display --json" , userName ) ;
296- let result = new ForceOrgDisplayResult ( JSON . parse ( response . commandOutput ) ) ;
296+ let commandOutput = JSON . parse ( response . commandOutput ) ;
297+ if ( ! commandOutput . result ) {
298+ return new ForceOrgDisplayResult ( ) ;
299+ }
300+ let result = new ForceOrgDisplayResult ( commandOutput . result ) ;
297301 result . cliCommand = response . cliCommand ;
298302 result . commandOutput = response . commandOutput ;
299303 return result ;
@@ -471,10 +475,10 @@ export class AppUtils {
471475 } ;
472476
473477 public static async connectOrg ( org : Org ) : Promise < void > {
474- let result = await this . execForceOrgDisplay ( org . orgName ) ;
478+ let result = await this . execForceOrgDisplay ( org . orgName , true ) ;
475479 if ( result . isConnected ) {
476- org . instanceUrl = result . InstanceUrl ;
477- org . accessToken = result . AccessToken ;
480+ org . instanceUrl = result . instanceUrl ;
481+ org . accessToken = result . accessToken ;
478482 } else {
479483 throw new Error ( RESOURCES . Home_Error_UnableToConnect ) ;
480484 }
@@ -822,20 +826,21 @@ export class AppUtils {
822826 output . commandOutput = commandResult ;
823827 output . cliCommand = cliCommand ;
824828 lines . forEach ( line => {
829+ line = line . trim ( ) ;
825830 if ( line . startsWith ( "Access Token" ) )
826- output . AccessToken = line . split ( ' ' ) . pop ( ) ;
831+ output . accessToken = line . split ( ' ' ) . pop ( ) ;
827832 if ( line . startsWith ( "Client Id" ) )
828- output . ClientId = line . split ( ' ' ) . pop ( ) ;
833+ output . clientId = line . split ( ' ' ) . pop ( ) ;
829834 if ( line . startsWith ( "Connected Status" ) )
830- output . ConnectedStatus = line . split ( ' ' ) . pop ( ) ;
835+ output . connectedStatus = line . split ( ' ' ) . pop ( ) ;
831836 if ( line . startsWith ( "Status" ) )
832- output . Status = line . split ( ' ' ) . pop ( ) ;
837+ output . status = line . split ( ' ' ) . pop ( ) ;
833838 if ( line . startsWith ( "Id" ) )
834- output . OrgId = line . split ( ' ' ) . pop ( ) ;
839+ output . orgId = line . split ( ' ' ) . pop ( ) ;
835840 if ( line . startsWith ( "Instance Url" ) )
836- output . InstanceUrl = line . split ( ' ' ) . pop ( ) ;
841+ output . instanceUrl = line . split ( ' ' ) . pop ( ) ;
837842 if ( line . startsWith ( "Username" ) )
838- output . Username = line . split ( ' ' ) . pop ( ) ;
843+ output . username = line . split ( ' ' ) . pop ( ) ;
839844 } ) ;
840845 return output ;
841846 } ;
0 commit comments