Skip to content
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

Exit code is reported as a success, 0, even when build fails #54

Closed
mmoayyed opened this issue Dec 15, 2023 · 2 comments
Closed

Exit code is reported as a success, 0, even when build fails #54

mmoayyed opened this issue Dec 15, 2023 · 2 comments
Assignees
Milestone

Comments

@mmoayyed
Copy link

mmoayyed commented Dec 15, 2023

Running with Gradle 8.5 with Java 21 (though I don't think this matters much), it appears when a Gradle task fails the exit code is reported as a success or 0.

To reproduce:

  • Download and unpack this
  • Make a compilation error in the source code
  • Run gm build
  • At this point, you should see BUILD FAILED. The run: echo $? and you'd see: 0.

If I use the native Gradle wrapper directly with ./gradlew build:

Configuration on demand is an incubating feature.
Calculating task graph as no cached configuration is available for tasks: build

> Task :compileJava FAILED
/Users/misagh/Downloads/demo/src/main/java/com/example/demo/DemoApplication.java:11: error: not a statement
                xlvhxjkhvjkxchvkjxchvkjxchvjk
                ^
/Users/misagh/Downloads/demo/src/main/java/com/example/demo/DemoApplication.java:11: error: ';' expected
                xlvhxjkhvjkxchvkjxchvkjxchvjk
                                             ^
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights.

At this point, echo $? shows 1 which is the correct exit code.

@aalmiray aalmiray self-assigned this Dec 15, 2023
@aalmiray aalmiray added this to the 0.13.0 milestone Dec 15, 2023
@aalmiray
Copy link
Contributor

Shipped in v0.13.0

@mmoayyed
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants