jeudi 9 mars 2017

Gradle cancel behavior inconsistent

A little background - I have a gradle script that FTPs our java tests over to a linux box, runs them, and FTPs the log back as it's running. When it sees a line that denotes build finished, it halts. I'm looking to add functionality such that when you stop the build in the IDE [red square button], it sends a telnet command over to the linux box that kills the test process using the PID which I collected at the start of the test.

At the moment, I have this functionality in the buildFinished closure, where I store some other cleanup items.

The problem I have is that depending on when I actually click the stop button, Gradle behaves differently. Sometimes it finishes and runs through the buildFinished closure as expected, and other times it just prints "Could not execute build using Gradle installation 'C:\Program Files (x86)\Gradle\gradle-2.13'" and exits on the local side immediately, without running the buildFinished closure. As far as I can tell, the prior happens when I cancel while it's uploading the scripts and java, and the latter happens if I cancel while the tests are executing on the linux machine.

Does anyone have any advice on why the behavior changes?

Bonus question - is there a better place I can put remote cancellation code than the buildFinished closure? Realistically, the remote cancel should only run when a cancel is detected, as unless it's cancelled the build should end normally anyway.

Thank you!

Aucun commentaire:

Enregistrer un commentaire