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()
492
492
// singleton is called on a thread with a runspace, but it is happening by coincidence.
493
493
using ( var ps = System . Management . Automation . PowerShell . Create ( RunspaceMode . CurrentRunspace ) )
494
494
{
495
- try
496
- {
495
+ try
496
+ {
497
497
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
501
506
{
502
- hostName = host . Name as string ;
503
507
}
504
508
}
505
- catch
506
- {
507
- }
508
- }
509
509
if ( hostName == null )
510
510
{
511
511
hostName = "PSReadline" ;
You can’t perform that action at this time.
0 commit comments