0

I'm using Jenkins 2.118 in Windows 7. I created a freestyle project and Use custom workspace.

I added Execute Windows batch command like this. enter image description here

The AutoStart.exe is a console application with no UI, which in turn starts some other child exe's. Once I start the build, the AutoStart.exe is shown up in the task manager and it started the other exe. After some automation job is done by the child exe's, AutoStarted will kill the child exe's and finish its job. Now Jenkins build is successful. Everything is working fine.

Now what I want to do is, once the build is in progress and if i manually abort the jenkins build with the [x] button, enter image description here I need to stop the automation job and kill the child exe's.

What I have done so far?

I assume that once build is aborted, the AutoStart.exe will get killed by jenkins and I write the logic for killing the child exe's in the exit event(taken from here) of AutoStart.exe. The breakpoint never hit in the exit function and I can still see the AutoStart.exe in task manager.

  • Anyone knows what exactly happens to an exe in the windows batch command once jenkins is aborted or build is completed?
  • Is there any way to exit the AutoStart.exe after abort?
  • Is there any way to call another exe to kill child exe's in some post build actions in jenkins?
  • Or any other ideas or suggestion to achieve this.

Any and all help is much appreciated. Thanks.

Sharon
  • 697
  • 4
  • 17
  • 41

1 Answers1

1

As mentioned here even if you abort the job, the 'Post build task' will run. So you can manage to execute some actions like identify and kill the child's exe's.

Joao Vitorino
  • 2,292
  • 1
  • 23
  • 44