-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose node task's execResult #11
Comments
+1 - I'm just looking at this now, because I want to redirect the output/error streams to something that isn't the console but then on an error condition, print out the entire output so it's not interleaved with the output from other tasks. |
Will pull in your pull request i a couple of hours. Thanks. |
@johnrengelman Can you share how you were able to redirect output/error streams? I'm trying to do the same thing, but standardOutput = new ByteArrayOutputStream()
errorOutput = standardOutput
ignoreExitValue = true
doLast {
if (result.exitValue != 0) {
println(standardOutput.toString())
throw new GradleException("exec failed; see output above")
}
} But |
I was able to get something to work, although I'm not sure it's the best strategy. If either of you have better suggestion, would appreciate it. ignoreExitValue = true
def execRunner = null
execOverrides {
execRunner = it
it.standardOutput = new ByteArrayOutputStream()
it.errorOutput = it.standardOutput
}
doLast {
if (result.exitValue != 0) {
println(execRunner.standardOutput.toString())
throw new GradleException("exec failed; see output above")
}
} |
The node task should expose it's execResult as the Gradle Exec task does.
Use case: I want to ignore the exit value of some of my node-based test tasks (i.e. ignoreExitValue = true), but retrieve their actual success/failure status via execResult.exitValue.
Thanks,
Lance
The text was updated successfully, but these errors were encountered: