Detect when IDE Stop button is pressed


(Kyle Woodworth) #1

Hi there,

We have a Gradle script that FTPs all of our Regression tests over to a linux box and runs them, then waits and FTPs/reads logs back to the laptop it was launched from. I’m looking to add functionality such that when you press the IDE “Stop” (red square) button, it kills the running process on the linux box. Right now, I have code early in the tests that prints the PID of the java over there, and code in the buildFinished closure that sends a telnet command to kill the process with the PID noted earlier.

The problem I’m running into is that if I press the stop button while Gradle is FTPing files over, it properly enters the buildFinished closure and runs my cleanup. If I press Stop button while it’s actually executing tests, it just tells me “Could not execute build using Gradle installation ‘C:\Program Files (x86)\Gradle\gradle-2.13’.” in my local IDE.

Optimally, I’d like to move my kill code over to somewhere that executes when it detects a “build stop” request. Is there anything like this? Does anyone have an idea why it behaves differently depending when I press stop?

Thank you!