File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/commands/force/org/beta Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -269,9 +269,14 @@ export class Create extends SfdxCommand {
269269 this . logger . debug ( 'Set Alias: %s result: %s' , this . flags . setalias , result ) ;
270270 }
271271 if ( this . flags . setdefaultusername ) {
272- const globalConfig : Config = this . configAggregator . getGlobalConfig ( ) ;
273- globalConfig . set ( Config . DEFAULT_USERNAME , username ) ;
274- const result = await globalConfig . write ( ) ;
272+ let config : Config ;
273+ try {
274+ config = await Config . create ( { isGlobal : false } ) ;
275+ } catch {
276+ config = await Config . create ( { isGlobal : true } ) ;
277+ }
278+ const result = config . set ( Config . DEFAULT_USERNAME , username ) ;
279+ await config . write ( ) ;
275280 this . logger . debug ( 'Set defaultUsername: %s result: %s' , this . flags . setdefaultusername , result ) ;
276281 }
277282 }
You can’t perform that action at this time.
0 commit comments