mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-07 09:06:03 +00:00
If CLI main thread fails, kill the JVM no matter what.
This prevents a long running CLI process (such as CloudBees OPE proccesses) to hang forever when the main thread fails. Whereas if the process terminates cleanly, the wrapper (such as systemd) can take corrective actions.
This commit is contained in:
1 parent
6dbf13ac2e
commit
1a8a00a82c
1 file changed
+7
-1
@@ -384,7 +384,13 @@ public class CLI {
|
||||
// h.setLevel(ALL);
|
||||
// l.addHandler(h);
|
||||
//
|
||||
System.exit(_main(_args));
|
||||
try {
|
||||
System.exit(_main(_args));
|
||||
} catch (Throwable t) {
|
||||
// if the CLI main thread die, make sure to kill the JVM.
|
||||
t.printStackTrace();
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
public static int _main(String[] _args) throws Exception {
|
||||
|
||||
Reference in new issue
Block a user