Merge pull request #7854 from Friendseeker/return-1-when-failed

[1.x] Return exit code `1` when client crashes & add smoke test for client
This commit is contained in:
eugene yokota 2024-11-03 01:07:08 -05:00 committed by GitHub
commit c5c094ee21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -160,6 +160,8 @@ jobs:
run: |
# test building sbtn on Linux
sbt "-Dsbt.io.virtual=false" nativeImage
# smoke test native Image
./client/target/bin/sbtn shutdown
# test launcher script
echo build using JDK 8 test using JDK 8 and JDK 11
cd launcher-package

View File

@ -9,19 +9,21 @@
package sbt.client;
import sbt.internal.client.NetworkClient;
import java.nio.file.Paths;
import org.fusesource.jansi.AnsiConsole;
public class Client {
public static void main(final String[] args) {
boolean isWin = System.getProperty("os.name").toLowerCase().startsWith("win");
boolean hadError = false;
try {
if (isWin) AnsiConsole.systemInstall();
NetworkClient.main(args);
} catch (final Throwable t) {
t.printStackTrace();
hadError = true;
} finally {
if (isWin) AnsiConsole.systemUninstall();
if (hadError) System.exit(1);
}
}
}