-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42252 from snazy/qml-no-exit-code
Fix `QuarkusMainLauncher` not returning exit code
- Loading branch information
Showing
7 changed files
with
126 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
integration-tests/picocli-native/src/main/java/io/quarkus/it/picocli/ExitCodeCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.quarkus.it.picocli; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
import picocli.CommandLine; | ||
|
||
@CommandLine.Command(name = "exitcode", versionProvider = DynamicVersionProvider.class) | ||
public class ExitCodeCommand implements Callable<Integer> { | ||
|
||
@CommandLine.Option(names = "--code") | ||
int exitCode; | ||
|
||
@Override | ||
public Integer call() { | ||
return exitCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
integration-tests/picocli/src/main/java/io/quarkus/it/picocli/ExitCodeCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.quarkus.it.picocli; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
import picocli.CommandLine; | ||
|
||
@CommandLine.Command(name = "exitcode") | ||
public class ExitCodeCommand implements Callable<Integer> { | ||
|
||
@CommandLine.Option(names = "--code") | ||
int exitCode; | ||
|
||
@Override | ||
public Integer call() { | ||
return exitCode; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
integration-tests/picocli/src/test/java/io/quarkus/it/picocli/TestExitCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.quarkus.it.picocli; | ||
|
||
import static io.quarkus.it.picocli.TestUtils.createConfig; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusProdModeTest; | ||
|
||
public class TestExitCode { | ||
|
||
@RegisterExtension | ||
static final QuarkusProdModeTest config = createConfig("hello-app", ExitCodeCommand.class) | ||
.setCommandLineParameters("--code", "42"); | ||
|
||
@Test | ||
public void simpleTest() { | ||
assertThat(config.getExitCode()).isEqualTo(42); | ||
} | ||
} |