Created
December 18, 2014 16:17
-
-
Save adamjasinski/9fd51fea69d9803a8561 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
function exec( [ScriptBlock] $cmd){ | |
( & $cmd ) 2>&1 # TeamCity doesn't show the output without the 2>&1 | |
if($LASTEXITCODE -ne 0){ | |
throw "Exec returned $LASTEXITCODE" | |
} | |
} | |
#Usage example: | |
#exec { git fetch } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment