mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Bubble up the return code correctly.
This commit is contained in:
parent
9339da0339
commit
5b95f47e9b
1 changed files with 8 additions and 6 deletions
|
@ -12,7 +12,8 @@ import java.util.zip.ZipFile;
|
||||||
//@com.beust.apt.processor.Version("1.3")
|
//@com.beust.apt.processor.Version("1.3")
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] argv) throws IOException, InterruptedException {
|
public static void main(String[] argv) throws IOException, InterruptedException {
|
||||||
new Main().installAndLaunchMain(argv);
|
int exitCode = new Main().installAndLaunchMain(argv);
|
||||||
|
System.exit(exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String KOBALT_PROPERTIES = "kobalt.properties";
|
private static final String KOBALT_PROPERTIES = "kobalt.properties";
|
||||||
|
@ -29,7 +30,7 @@ public class Main {
|
||||||
private static int logLevel = 1;
|
private static int logLevel = 1;
|
||||||
private boolean noOverwrite = false;
|
private boolean noOverwrite = false;
|
||||||
|
|
||||||
private void installAndLaunchMain(String[] argv) throws IOException, InterruptedException {
|
private int installAndLaunchMain(String[] argv) throws IOException, InterruptedException {
|
||||||
List<String> kobaltArgv = new ArrayList<>();
|
List<String> kobaltArgv = new ArrayList<>();
|
||||||
boolean noLaunch = false;
|
boolean noLaunch = false;
|
||||||
for (int i = 0; i < argv.length; i++) {
|
for (int i = 0; i < argv.length; i++) {
|
||||||
|
@ -53,9 +54,11 @@ public class Main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Path kobaltJarFile = installDistribution();
|
Path kobaltJarFile = installDistribution();
|
||||||
|
int result = 0;
|
||||||
if (! noLaunch) {
|
if (! noLaunch) {
|
||||||
launchMain(kobaltJarFile, kobaltArgv.toArray(new String[kobaltArgv.size()]));
|
result = launchMain(kobaltJarFile, kobaltArgv.toArray(new String[kobaltArgv.size()]));
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readProperties(Properties properties, InputStream ins) throws IOException {
|
private void readProperties(Properties properties, InputStream ins) throws IOException {
|
||||||
|
@ -375,7 +378,7 @@ public class Main {
|
||||||
System.out.println("[Wrapper error] *** " + s);
|
System.out.println("[Wrapper error] *** " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchMain(Path kobaltJarFile, String[] argv) throws IOException, InterruptedException {
|
private int launchMain(Path kobaltJarFile, String[] argv) throws IOException, InterruptedException {
|
||||||
List<String> args = new ArrayList<>();
|
List<String> args = new ArrayList<>();
|
||||||
args.add("java");
|
args.add("java");
|
||||||
args.add("-jar");
|
args.add("-jar");
|
||||||
|
@ -386,8 +389,7 @@ public class Main {
|
||||||
pb.inheritIO();
|
pb.inheritIO();
|
||||||
log(2, "Launching " + args);
|
log(2, "Launching " + args);
|
||||||
Process process = pb.start();
|
Process process = pb.start();
|
||||||
process.waitFor();
|
return process.waitFor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue