Skip to content

Commit 78a6020

Browse files
committed
Print exit code along with process failures
1 parent 2803cb6 commit 78a6020

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/main/java/net/minecraftforge/mcmaven/impl/mappings/Mappings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private File getMappings(MCPSide side, Task srgMappings, Task clientTask, Task s
219219

220220
var ret = ProcessUtils.runJar(jdk, log.getParentFile(), log, tool, Collections.emptyList(), args);
221221
if (ret.exitCode != 0)
222-
throw new IllegalStateException("Failed to run MCP Step, See log: " + log.getAbsolutePath());
222+
throw new IllegalStateException("Failed to run MCP Step (exit code " + ret.exitCode + "), See log: " + log.getAbsolutePath());
223223

224224
cache.save();
225225
return output;

src/main/java/net/minecraftforge/mcmaven/impl/repo/forge/Patcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ public static File modifyAccess(File globalBase, Task inputTask, File cfg, Cache
437437

438438
var ret = ProcessUtils.runJar(jdk, globalBase, log, tool, Collections.emptyList(), args);
439439
if (ret.exitCode != 0)
440-
throw new IllegalStateException("Failed to run Access Transformer, See log: " + log.getAbsolutePath());
440+
throw new IllegalStateException("Failed to run Access Transformer (exit code " + ret.exitCode + "), See log: " + log.getAbsolutePath());
441441

442442
cache.save();
443443
return output;
@@ -476,7 +476,7 @@ public static File stripSides(File globalBase, Task inputTask, File cfg, Cache d
476476

477477
var ret = ProcessUtils.runJar(jdk, globalBase, log, tool, Collections.emptyList(), args);
478478
if (ret.exitCode != 0)
479-
throw new IllegalStateException("Failed to run Side Stripper, See log: " + log.getAbsolutePath());
479+
throw new IllegalStateException("Failed to run Side Stripper (exit code " + ret.exitCode + "), See log: " + log.getAbsolutePath());
480480

481481
cache.save();
482482
return output;
@@ -550,7 +550,7 @@ private File postProcess(Task inputTask, PatcherConfig.V2.DataFunction data, Fil
550550

551551
var ret = ProcessUtils.runJar(jdk, log.getParentFile(), log, tool, data.getJvmArgs(), args);
552552
if (ret.exitCode != 0)
553-
throw new IllegalStateException("Failed to run MCP Step, See log: " + log.getAbsolutePath());
553+
throw new IllegalStateException("Failed to run MCP Step (exit code " + ret.exitCode + "), See log: " + log.getAbsolutePath());
554554

555555
cache.save();
556556
return output;

src/main/java/net/minecraftforge/mcmaven/impl/repo/mcpconfig/MCPTaskFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ private File execute(List<TaskOrArg> jvmArgs, List<TaskOrArg> runArgs, MCPConfig
863863

864864
var ret = ProcessUtils.runJar(jdk, log.getParentFile(), log, tool, jvm, run);
865865
if (ret.exitCode != 0)
866-
throw new IllegalStateException("Failed to run MCP Step, See log: " + log.getAbsolutePath());
866+
throw new IllegalStateException("Failed to run MCP Step (exit code " + ret.exitCode + "), See log: " + log.getAbsolutePath());
867867

868868
cache.save();
869869
return output;

src/main/java/net/minecraftforge/mcmaven/impl/util/ProcessUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ public static int runCommand(File workDir, Consumer<String> lines, String... arg
146146
}
147147
}
148148

149-
return process.exitValue();
149+
var exitValue = process.exitValue();
150+
if (exitValue != 0)
151+
lines.accept("Process returned non-zero exit value: " + exitValue);
152+
return exitValue;
150153
}
151154

152155
static Path getPathFromResource(String resource) {

0 commit comments

Comments
 (0)