diff --git a/src/main/java/org/jvnet/hudson/test/RealJenkinsRule.java b/src/main/java/org/jvnet/hudson/test/RealJenkinsRule.java index 3a5dd86ee..102eedb47 100644 --- a/src/main/java/org/jvnet/hudson/test/RealJenkinsRule.java +++ b/src/main/java/org/jvnet/hudson/test/RealJenkinsRule.java @@ -1155,6 +1155,19 @@ public void stopJenkins() throws Throwable { } } + /** + * Stops Jenkins abruptly, without giving it a chance to shut down cleanly. + * If Jenkins is already stopped then invoking this method has no effect. + */ + public void stopJenkinsForcibly() { + if (proc != null) { + var _proc = proc; + proc = null; + System.err.println("Killing the Jenkins process as requested"); + _proc.destroyForcibly(); + } + } + /** * Runs one or more steps on the remote system. * (Compared to multiple calls, passing a series of steps is slightly more efficient