Can a build be stopped in the daemon without killing the daemon?

I can’t figure out a way to stop a build without killing the daemon running it. If I use ^D, it doesn’t stop the build (like in a continuous build) and if I use ^C it kills the daemon. Is there something special I’m missing?

Gradle Version: 3.0
Operating System: macOS Sierra 10.12 Beta (16A294a)
Is this a regression? No

At the time of this writing, there isn’t a clean way to do so. With 3.1, we will change most (if not all) of the ^C scenarios to cancel the build rather than stopping the daemon. Having said that, though, there will be scenarios where we may still start a new daemon on the next invocation (such as when the build is canceled during a task that will never complete or a task that takes sufficiently long to complete that we time out). Under most circumstances, though, hitting ^C will cause the current build to cancel and the daemon will stay running and be available for subsequent builds.

2 Likes

You programmatically add a doFirst to every task which checks for a “stop” file and throws BuildException if found (and delete the file).

You could then kill by touching the “stop” file. This obviously wouldn’t be immediate and would stop at the next doFirst invocation

Possibly that’s good enough?