File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -492,20 +492,20 @@ private PSConsoleReadLine()
492492 // singleton is called on a thread with a runspace, but it is happening by coincidence.
493493 using ( var ps = System . Management . Automation . PowerShell . Create ( RunspaceMode . CurrentRunspace ) )
494494 {
495- try
496- {
495+ try
496+ {
497497 ps . AddCommand ( "Get-Variable" ) . AddParameter ( "Name" , "host" ) . AddParameter ( "ValueOnly" ) ;
498- var results = ps . Invoke ( ) ;
499- dynamic host = results . Count == 1 ? results [ 0 ] : null ;
500- if ( host != null )
498+ var results = ps . Invoke ( ) ;
499+ dynamic host = results . Count == 1 ? results [ 0 ] : null ;
500+ if ( host != null )
501+ {
502+ hostName = host . Name as string ;
503+ }
504+ }
505+ catch
501506 {
502- hostName = host . Name as string ;
503507 }
504508 }
505- catch
506- {
507- }
508- }
509509 if ( hostName == null )
510510 {
511511 hostName = "PSReadline" ;
You can’t perform that action at this time.
0 commit comments