On Wed, May 18, 2011 at 5:05 AM, Sean Van Buggenum <[email protected]> wrote:
> On linux, I was testing my gradle code, and all worked. > Now I am running it in production, but (unfortunately) on windows, and it > doesn't seem to work. > > The code calls a gradle script from another gradle script, and uses the > exit value to determine which action to perform. > However, on windows, even though there was an error (and on linux, the > called gradle script would return non-zero) > the return value is '0'. > Is this because on windows, the gradle.bat batch file is used? Is this > somehow different ? > > Yes, your problem is Windows. When executing scripts, their return value is not made available to the caller (if instantiated directly). What you need to do is this: %COMSPEC% /c gradle.bat.... That will return your exit value. However, for starting Gradle, the better solution is to use: GradleLauncher launcher = GradleLauncher.newInstance(someStartParameter) BuildResult result = launcher.run() Cheers, Jesper
