From ebd9aecd30edd66d5920a5234d5f398d50e7e9b9 Mon Sep 17 00:00:00 2001 From: Paul Bouwer Date: Mon, 30 Mar 2015 20:08:14 +1100 Subject: [PATCH] Issue #67 - Exit codes from scriptcs.exe are not propagated --- src/shims/scriptcs.cmd | 1 + src/shims/scriptcs.ps1 | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/shims/scriptcs.cmd b/src/shims/scriptcs.cmd index 5991111..e317f75 100644 --- a/src/shims/scriptcs.cmd +++ b/src/shims/scriptcs.cmd @@ -1,3 +1,4 @@ @echo off PowerShell -NoProfile -NoLogo -ExecutionPolicy Unrestricted -Command "& '%~dp0scriptcs.ps1' -- %*" +EXIT /B %ERRORLEVEL% \ No newline at end of file diff --git a/src/shims/scriptcs.ps1 b/src/shims/scriptcs.ps1 index 69be973..9a26c60 100644 --- a/src/shims/scriptcs.ps1 +++ b/src/shims/scriptcs.ps1 @@ -60,25 +60,29 @@ function Get-ScriptCsExecutable # shim # +$EXITCODE_ERROR = 1 + try { $version = Get-ActiveVersion if (String-IsEmptyOrWhitespace($version)) { Write-ErrorMessage "No active scriptcs found. Use 'svm use ' to set the active scriptcs version." - exit + exit $EXITCODE_ERROR } $scriptcs = Get-ScriptCsExecutable $version if (!(Test-Path $scriptcs)) { Write-ErrorMessage "The active scriptcs could not be found at '$scriptcs'. Use 'svm use ' to correctly set the active scriptcs version." - exit + exit $EXITCODE_ERROR } &$scriptcs $args + exit $LASTEXITCODE } catch { Write-ErrorMessage $_ + exit $EXITCODE_ERROR }