diff --git a/pester-extensions.psm1 b/pester-extensions.psm1 index 5dabffd..8a5953d 100644 --- a/pester-extensions.psm1 +++ b/pester-extensions.psm1 @@ -7,14 +7,16 @@ Pester extension that allows to run command and validate exit code function Get-CommandResult { Param ( - [Parameter(Mandatory)][string] $Command + [Parameter(Mandatory=$true)] + [string] $Command, + [switch] $Multiline ) # CMD trick to suppress and show error output because some commands write to stderr (for example, "python --version") [string[]]$output = & $env:comspec /c "$Command 2>&1" $exitCode = $LASTEXITCODE return @{ - Output = $output + Output = If ($Multiline -eq $true) { $output } else { [string]$output } ExitCode = $exitCode } }