Skip to content

Commit ca24126

Browse files
committed
Make sure the commands succeed in BuildInformationProcessor
1 parent c0779a5 commit ca24126

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/processor/java/org/truffleruby/processor/BuildInformationProcessor.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,20 @@ private File findHome() throws URISyntaxException {
8080
return source.getParentFile();
8181
}
8282

83-
private String runCommand(String command) throws IOException {
83+
private String runCommand(String command) throws IOException, InterruptedException {
8484
final Process git = new ProcessBuilder(command.split("\\s+"))
8585
.directory(trufflerubyHome)
8686
.start();
87+
final String firstLine;
8788
try (BufferedReader reader = new BufferedReader(new InputStreamReader(git.getInputStream()))) {
88-
return reader.readLine();
89+
firstLine = reader.readLine();
8990
}
91+
92+
final int exitCode = git.waitFor();
93+
if (exitCode != 0) {
94+
throw new Error("Command " + command + " failed with exit code " + exitCode);
95+
}
96+
return firstLine;
9097
}
9198

9299
@Override

0 commit comments

Comments
 (0)