Repository navigation
fix: ensuring exit codes are handled consistently - #38661
Conversation
2347344 to
2b85351
Compare
closes: keycloak#38161 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Signed-off-by: Steve Hawkins <shawkins@redhat.com>
|
We were making the test launch mode pull double duty. It was both causing an early exit, and preventing System.exit calls. Rather than removing the launch mode from the raw dist, I'm using it only for the early exit. Now we attempt to detect what type of launch were using by the classloader and adjust our exit handling accordingly. @pedroigor does this work for you / embedded usage? |
There was a problem hiding this comment.
LGTM, thanks.
I tested the embedded server and it seems fine – even better than before as it nows properly exits the process on error instead of just hanging.
| int exitCode = ApplicationLifecycleManager.getExitCode(); | ||
|
|
||
| if (isTestLaunchMode() || isNonServerMode()) { | ||
| // in test mode we exit immediately | ||
| // we should be managing this behavior more dynamically depending on the tests requirements (short/long lived) | ||
| Quarkus.asyncExit(exitCode); | ||
| Quarkus.asyncExit(ApplicationLifecycleManager.getExitCode()); | ||
| } else { | ||
| Quarkus.waitForExit(); | ||
| } | ||
|
|
||
| return exitCode; | ||
| return ApplicationLifecycleManager.getExitCode(); |
There was a problem hiding this comment.
Jus out of curiosity, why is this change needed? Why can't we store the exit code in a var?
There was a problem hiding this comment.
That's a potential bug, we don't want to store it because it could change while the waiting for exit.
closes: #38161