Re: exec builder does not capture the return, value of the called batch file on windows
Dan Rollo <[email protected]>
| Newsgroups | gmane.comp.java.cruise-control.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Martin,
Really? Yuck!
Have you checked the behavior without the "/B" switch?
You might also want to try checking the behavior with a new shell in the
exec command, like:
<exec
command="cmd /C
R:\software\scripts\utils\cruise-control\always-fails.bat"
...
I'm guessing this behavior is new, otherwise I would have expected other
batch file users to have seen it and mentioned it before.
Not sure if we can safely twiddle the exec command to add &,
but at the very least we should document this weirdness.
Also, if you can come up with some unit tests that verify the behavior
you're describing, we can add them to the test suite so we might be
warned if behaviors change.
Dan
Date: Tue, 29 Mar 2011 12:47:45 +0100
From: [email protected]
Subject: [Cruisecontrol-user] exec builder does not capture the return
value of the called batch file on windows
To: [email protected]
Message-ID:
<OF9FAC44ED.97977CAE-ON80257862.004097F5-80257862.0040CC7C@Selex-Comms.com>
Content-Type: text/plain; charset="us-ascii"
I have searched the mail list archive and not found anything relating
to this, but the exec builder does not appear to capture the return
value of the called batch file on windows. I believe this is a
fault/special odd behaviour of windows command shell.
If I write an exec builder thusly:
<schedule interval="5">
<exec
command="R:\software\scripts\utils\cruise-control\always-fails.bat"
workingdir="R:\software\"
args="> R:\output-vc90\artifact.txt"/>
</schedule>
and the batch file so:
echo I is broken
exit /B 100
even tho the documentation says:
<exec>
Runs a specified command or script as part of the build. Reports build
failure if the command cannot be run or returns an error.
the project will always report success. Now if you want to use the
return values of your scripts rather search for the <errorstr> this
is a bit disabling. I found that things are fixed if the command is
forced to evaluate a string, so adding & exit will make it work. So:
<schedule interval="5">
<exec
command="R:\software\scripts\utils\cruise-control\always-fails.bat"
workingdir="R:\software\"
args="> R:\output-vc90\artifact.txt" & exit/>
</schedule>
Maybe the " & exit" could be added under the covers by cruise if it's
not already there to make the exec builder behave as it's documentation on
windows.
This would fix such problems as reported at;
http://markmail.org/message/xhwi5qluufkeyrom
This was a real b*gger to find so I hope others will get benefit.
Martin
--
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf