Skip to content
This repository
Browse code

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...
commit c93fcd40b31dc45a4fec5c93fe1eb4e2a2d74900 1 parent 3b4f9ff
James Kovacs authored May 18, 2010
7  examples/use_exit_code.ps1
... ...
@@ -0,0 +1,7 @@
  1
+$psake.use_exit_on_error = $true
  2
+
  3
+task default -depends throw_error
  4
+
  5
+task throw_error {
  6
+  throw "Error"
  7
+}
2  psake.cmd
... ...
@@ -1,2 +1,2 @@
1 1
 @echo off
2  
-powershell -NoProfile -ExecutionPolicy unrestricted -Command "& {Import-Module %~dp0\psake.psm1; invoke-psake %*; remove-module psake }"
  2
+powershell -NoProfile -ExecutionPolicy unrestricted -Command "%~dp0\psake.ps1 %*"
11  psake.ps1
@@ -19,7 +19,10 @@ param(
19 19
   [System.Collections.Hashtable]$properties = @{}
20 20
 )
21 21
 
22  
-$scriptPath = Split-Path -parent $MyInvocation.InvocationName;
23  
-import-module (join-path $scriptPath psake.psm1)
24  
-invoke-psake $buildFile $taskList $framework $docs $parameters $properties
25  
-remove-module psake -ea "SilentlyContinue"
  22
+try {
  23
+  $scriptPath = Split-Path -parent $MyInvocation.InvocationName;
  24
+  import-module (join-path $scriptPath psake.psm1)
  25
+  invoke-psake $buildFile $taskList $framework $docs $parameters $properties
  26
+} finally {
  27
+  remove-module psake -ea 'SilentlyContinue'
  28
+}

0 notes on commit c93fcd4

Please sign in to comment.
Something went wrong with that request. Please try again.