Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ private static String gitCommand(Path dir, String... args) throws IOException, I
new ProcessBuilder().command(args).directory(dir.toFile()).start();

Preconditions.checkState(process.waitFor(30, TimeUnit.SECONDS), "git diff took too long to terminate");
Preconditions.checkState(process.exitValue() == 0, "Expected return code of 0");

if (process.exitValue() != 0) {
throw new RuntimeException("Expected return code of 0 but got " + process.exitValue()
+ "\n stdout: " + new String(process.getInputStream().readAllBytes())
+ "\n stderr: " + new String(process.getErrorStream().readAllBytes()));
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
process.getInputStream().transferTo(baos);
return new String(baos.toByteArray(), UTF_8).trim();
Expand Down