Recently I have been integrating Rake with Nant. Specifically, I have
been creating Nant tasks that trigger Rake. In the process of doing
this, I have run into a problem: namely when Rake fails, Nant thinks
that it succeeds. I have tracked down the problem to the Rake batch
file, apparently created by the Gem system, that is used to invoke
The problem is that the return code (which is 1, failure) returned
Ruby process is not propagated by the Rake batch file. Nant thus sees
a return code of 0 (success). I have worked around this problem by not
using the Rake batch file and invoking ruby.exe directly. However, it
seems to me that others may also run into this problem, and also that
the Gem batch file generation system could be fixed. I suspect this
problem could also affect other gems besides Rake.
Here is my original Nant task, which did not correctly report Rake
Here is my corrected Nant task:
Here is some information from CC.Net (which I am also using) that I
used to help debug return codes (aka error levels) on Windows:
See “CruiseControl.NET is reporting that the build succeeded when it
A collegue suggested that I directly modify the batch file, but since
it seems to be autogenerated by Rake, and it doesn’t seem to actually
be doing very much (I turned “@echo on” to see what it was doing), I
figured it would be easier to simply avoid using it.
I would appreciate comments and alternate suggestions.