From eac57de21607dffd6f2a1d6e8ff06480d7724716 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 5 Jul 2016 16:02:06 -0700 Subject: [PATCH] Fix use of Get-Command when more than one exists --- .../engine/InitialSessionState.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index f25dfcb771..d53c3ce962 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -4740,7 +4740,7 @@ $RawUI.SetBufferContents( else { // Porting note: non-Windows platforms use `clear` - return "& (Get-Command -CommandType Application clear).Definition | Select-Object -First 1"; + return "& (Get-Command -CommandType Application clear | Select-Object -First 1).Definition"; } } @@ -5483,11 +5483,11 @@ $OutputEncoding = if ($IsWindows -and $IsCore) { # Respect PAGER, use more on Windows, and use less on Linux if (Test-Path env:PAGER) { - $moreCommand = (Get-Command -CommandType Application $env:PAGER).Definition | Select-Object -First 1 + $moreCommand = (Get-Command -CommandType Application $env:PAGER | Select-Object -First 1).Definition } elseif ($IsWindows) { - $moreCommand = (Get-Command -CommandType Application more).Definition | Select-Object -First 1 + $moreCommand = (Get-Command -CommandType Application more | Select-Object -First 1).Definition } else { - $moreCommand = (Get-Command -CommandType Application less).Definition | Select-Object -First 1 + $moreCommand = (Get-Command -CommandType Application less | Select-Object -First 1).Definition } if($paths) {