mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
update markdown tests (#7838)
update markdown tests - explicitly use gulp 4.0 beta because 3.9 depends on a vulnerable package
This commit is contained in:
1 parent
84634445ce
commit
8a0abf459c
10 files changed
+2821
-973
No files matched your search
@@ -23,6 +23,7 @@ FunctionsToExport = @(
|
||||
'Get-RandomFileName'
|
||||
'Send-VstsLogFile'
|
||||
'Set-TesthookResult'
|
||||
'Start-NativeExecution'
|
||||
'Test-IsElevated'
|
||||
'Test-IsRoot'
|
||||
'Test-IsVstsLinux'
|
||||
|
||||
@@ -266,3 +266,50 @@ function Test-IsVstsWindows
|
||||
{
|
||||
return ($env:TF_BUILD -and $IsWindows)
|
||||
}
|
||||
|
||||
# this function wraps native command Execution
|
||||
# for more information, read https://mnaoumov.wordpress.com/2015/01/11/execution-of-external-commands-in-powershell-done-right/
|
||||
function Start-NativeExecution
|
||||
{
|
||||
param(
|
||||
[scriptblock]$sb,
|
||||
[switch]$IgnoreExitcode,
|
||||
[switch]$VerboseOutputOnError
|
||||
)
|
||||
$backupEAP = $script:ErrorActionPreference
|
||||
$script:ErrorActionPreference = "Continue"
|
||||
try {
|
||||
if($VerboseOutputOnError.IsPresent)
|
||||
{
|
||||
$output = & $sb 2>&1
|
||||
}
|
||||
else
|
||||
{
|
||||
& $sb
|
||||
}
|
||||
|
||||
# note, if $sb doesn't have a native invocation, $LASTEXITCODE will
|
||||
# point to the obsolete value
|
||||
if ($LASTEXITCODE -ne 0 -and -not $IgnoreExitcode) {
|
||||
if($VerboseOutputOnError.IsPresent -and $output)
|
||||
{
|
||||
$output | Out-String | Write-Verbose -Verbose
|
||||
}
|
||||
|
||||
# Get caller location for easier debugging
|
||||
$caller = Get-PSCallStack -ErrorAction SilentlyContinue
|
||||
if($caller)
|
||||
{
|
||||
$callerLocationParts = $caller[1].Location -split ":\s*line\s*"
|
||||
$callerFile = $callerLocationParts[0]
|
||||
$callerLine = $callerLocationParts[1]
|
||||
|
||||
$errorMessage = "Execution of {$sb} by ${callerFile}: line $callerLine failed with exit code $LASTEXITCODE"
|
||||
throw $errorMessage
|
||||
}
|
||||
throw "Execution of {$sb} failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
} finally {
|
||||
$script:ErrorActionPreference = $backupEAP
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user