File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -793,14 +793,23 @@ def runTest( ) {
793793 }
794794 }
795795 } catch (Exception e) {
796- handleException(e)
797- } finally {
798- // Cleanup: Terminate any running processes if the build was aborted
799- if (wasAborted || currentBuild. result == ' ABORTED' ) {
800- echo " Cleaning up any running child jobs due to build being aborted..."
801- // Add logic to abort child processes if necessary
802- // Example: sh "pkill -f 'your_process_name'"
803- }
796+ println (" Exception: " + e. toString())
797+ if (e. toString(). contains(" FlowInterruptedException" )) {
798+ currentBuild. result = ' ABORTED'
799+ } else {
800+ currentBuild. result = ' FAILURE'
801+ }
802+
803+ } finally {
804+ if (currentBuild. rawBuild. isInterrupted()) {
805+ println (" Parent job is aborted. Aborting any child jobs..." )
806+ // Add code to abort child jobs, if any are running
807+ for (child in currentBuild. rawBuild. getDownstreamBuilds()) {
808+ if (child. isBuilding()) {
809+ child. doStop()
810+ }
811+ }
812+ }
804813 }
805814
806815 if (params. CODE_COVERAGE ) {
You can’t perform that action at this time.
0 commit comments