forked from exercism/csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared.ps1
More file actions
24 lines (20 loc) · 693 Bytes
/
shared.ps1
File metadata and controls
24 lines (20 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ErrorActionPreference = 'Stop'
# PowerShell does not check the return code of native commands.
# There is a pending proposal to support this:
# https://github.com/PowerShell/PowerShell-RFC/pull/88/files
# https://github.com/PowerShell/PowerShell-RFC/pull/261
function Invoke-CallScriptExitOnError ($ScriptBlock) {
<#
.SYNOPSIS
Run a native command.
.PARAMETER Command
The command to execute.
.EXAMPLE
The example below runs the { ./bin/configlet lint } script block
Invoke-CallScriptExitOnError { ./bin/configlet lint }
#>
& $ScriptBlock
if ($Lastexitcode -ne 0) {
exit $Lastexitcode
}
}