JavaExec, SIGINT, daemon and background server processes


(Julien Ponge) #1

Hi,

I’m having a JavaExec task that runs some server code, but I find myself trapped by the Gradle behaviour when hitting Ctrl+C to stop it when using the Gradle daemon mode (which is the default).

The forked server stills runs in the background, so the only option is to run my Gradle build and task with --no-daemon.

Is there a better way to catch a SIGINT and ensure the JavaExec task gets killed instead of still running in background?

Thanks!


(Sterling Greene) #2

Which OS/Gradle version is this on?


(Julien Ponge) #3

4.1 on macOS.

The JavaExec task spins some application code under development that opens TCP servers. I would just expect a SIGINT to also cleanup the background jobs.


(Sterling Greene) #4

How are the other applications started from the Java application that Gradle starts? I would have expected child processes to be killed too.

Do you have a build that reproduces that behavior reliably?


(Julien Ponge) #5

This plugin: https://github.com/jponge/vertx-gradle-plugin