Skip to content

Commit 58ecd07

Browse files
committed
Merge pull request #22 from jeffbski/master
added system property to allow JarMain to not use System.exit in normal flow, this was causing problem when using a service wrapper
2 parents 8056701 + 553cda7 commit 58ecd07

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ext/JarMain.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void run() {
129129
public static void main(String[] args) {
130130
try {
131131
int exit = new JarMain(args).start();
132-
System.exit(exit);
132+
if(isSystemExitEnabled()) System.exit(exit);
133133
} catch (Exception e) {
134134
Throwable t = e;
135135
while (t.getCause() != null && t.getCause() != t) {
@@ -146,4 +146,13 @@ public static void main(String[] args) {
146146
private static boolean isDebug() {
147147
return System.getProperty("warbler.debug") != null;
148148
}
149+
150+
/**
151+
* if warbler.skip_system_exit system property is defined, we will not
152+
* call System.exit in the normal flow. System.exit can cause problems
153+
* for wrappers like procrun
154+
*/
155+
private static boolean isSystemExitEnabled(){
156+
return System.getProperty("warbler.skip_system_exit") == null; //omission enables System.exit use
157+
}
149158
}

0 commit comments

Comments
 (0)