Permalink
Browse files

Added psake.cmd for ease of calling from cmd.exe.

Updated psake.ps1 to include try/finally otherwise exit code is not returned to caller.
  • Loading branch information...
JamesKovacs committed May 19, 2010
1 parent 3b4f9ff commit c93fcd40b31dc45a4fec5c93fe1eb4e2a2d74900
Showing with 15 additions and 5 deletions.
  1. +7 −0 examples/use_exit_code.ps1
  2. +1 −1 psake.cmd
  3. +7 −4 psake.ps1
@@ -0,0 +1,7 @@
+$psake.use_exit_on_error = $true
+
+task default -depends throw_error
+
+task throw_error {
+ throw "Error"
+}
View
@@ -1,2 +1,2 @@
@echo off
-powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {Import-Module %~dp0\psake.psm1; invoke-psake %*; remove-module psake }"
+powershell -NoProfile -ExecutionPolicy unrestricted -Command "%~dp0\psake.ps1 %*"
View
@@ -19,7 +19,10 @@ param(
[System.Collections.Hashtable]$properties = @{}
)
-$scriptPath = Split-Path -parent $MyInvocation.InvocationName;
-import-module (join-path $scriptPath psake.psm1)
-invoke-psake $buildFile $taskList $framework $docs $parameters $properties
-remove-module psake -ea "SilentlyContinue"
+try {
+ $scriptPath = Split-Path -parent $MyInvocation.InvocationName;
+ import-module (join-path $scriptPath psake.psm1)
+ invoke-psake $buildFile $taskList $framework $docs $parameters $properties
+} finally {
+ remove-module psake -ea 'SilentlyContinue'
+}

0 comments on commit c93fcd4

Please sign in to comment.