From a7f5d28f5f986357b0033c9443a6883ced06125d Mon Sep 17 00:00:00 2001 From: Mike Richmond Date: Thu, 4 Aug 2016 16:46:44 -0700 Subject: [PATCH] Fixing Start-PSPester for non-Windows environments. --- build.psm1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index b16310978..c88f16525 100644 --- a/build.psm1 +++ b/build.psm1 @@ -539,7 +539,12 @@ function Start-PSPester { Write-Verbose "Import-Module '$moduleDir'; Invoke-Pester $tagString $Path" $powershellexe = get-psoutput - & $powershell -noprofile -c "Set-ExecutionPolicy -Scope Process Unrestricted; Import-Module '$moduleDir'; Invoke-Pester $tagString $Path" + $execPolicy = "" + if ($IsWindows) + { + $execPolicy = "Set-ExecutionPolicy -Scope Process Unrestricted; " + } + & $powershell -noprofile -c "$execPolicy Import-Module '$moduleDir'; Invoke-Pester $tagString $Path" if ($LASTEXITCODE -ne 0) { throw "$LASTEXITCODE Pester tests failed" }