gradle-execfork-plugin icon indicating copy to clipboard operation
gradle-execfork-plugin copied to clipboard

daemon support: option to leave forked-process running beyond build, non-stopAfter

Open javabrett opened this issue 8 years ago • 1 comments

Not sure this is a particularly Gradle-ish or build-sane thing to do, but I was looking in Gradle and in some other plugins for the ability to have Gradle launch a daemon task - a long-running forked child-process that outlives the current build (even the JVM that forks it if not running the Gradle Daemon).

I guess it's a choice between having a Gradle build that it expected to block-forever (could be backgrounded) waiting for an exit condition so it can clean-up the daemon, versus a build that has known side-effects (leaves processed running).

If backward compatibility were not a concern, ideally a stopAfter=null could mean this, but that currently represents stopOnBuildCompletion.

javabrett avatar Oct 27 '17 20:10 javabrett

Could be achieved by adding a property like killOnExit (Default: true for downward compatibility) to com.github.psxpaul.task.AbstractExecFork and applying it to:

fun stop() {
        if (process != null && process!!.isAlive && killOnExit)
            process!!.destroyForcibly().waitFor(15, TimeUnit.SECONDS)
}

Haratsu avatar Jul 18 '18 23:07 Haratsu