I have written some piece of code inside javaagent loaded via jvmArgs
in Gradle Test Task. I’m trying to gracefully exit the process (Test Executor Process) from the javaagent or maybe throw fatal exception so that it don’t run the process further.
But no luck. When I try to do System.exit()
, then the execution goes on a loop and keep on spawning the Tests.
Any way we can handle this scenario with Gradle? I’m able to achieve this with System.exit
inside maven project.
More Info : I have seen that the Test Executor itself executes System.exit
post running the tests - gradle/subprojects/worker-processes/src/main/java/org/gradle/process/internal/worker/GradleWorkerMain.java at 7d6581558e226a580d91d399f7dfb9e3095c2b1d · gradle/gradle · GitHub
How can we achieve this prematurely, like in a javaagent?