Hi all, This matter is quite important for us, so any help is appreciated. I'm not sure if this is a Jenkins bug or limitation. Apparently the challenge looks like JENKINS-17116 <https://issues.jenkins.io/browse/JENKINS-17116> but in essence is pretty different. I'm working on:hpe-application-automation-tools-plugin <https://github.com/jenkinsci/hpe-application-automation-tools-plugin/> and need to assure a graceful job termination on user's abort action.
During the job build, the flow is reaching the following step (common for both: free-style job and pipeline job): On line 111 from AlmToolsUtils.java <https://github.com/jenkinsci/hpe-application-automation-tools-plugin/blob/latest/src/main/java/com/microfocus/application/automation/tools/AlmToolsUtils.java> we launch a long-executing process (C# executable with arguments): int returnCode = launcher.launch().cmds(args).stdout(out).pwd(file.getParent ()).envs(envs).*join**()*; Where the method join() is defined in hudson.Launcher <https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/Launcher.java> : // Starts the process and waits for its completion. public int join() throws IOException, InterruptedException { ... final int returnCode = procHolderForJoin.join(); ... } Where the method procHolderForJoin.join() is defined in hudson.Proc.LocalProc <https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/Proc.java> : // Waits for the completion of the process. public int join() throws InterruptedException, IOException { ... try { *int** r = proc.waitFor();* ... return r; } catch (InterruptedException e) { // aborting. kill the process *destroy**();* throw e; } finally { t.setName(oldName); } } If the user aborts the job (so that the InterruptedException is automatically fired by Jenkins), is there a way to call a cleanup (callback) method before the process is killed by *destroy**()*? (I mean a callback method defined on either plugin-side or C# process-side). Any suggestions? Please advise. Thanks, Dorin. -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAPcceE30kKWzcqteR%2BP0r-O0pOC8V616CpHvzwykZNAtSiVE_g%40mail.gmail.com.
