diff --git a/test/v2-migration-tests/src/test/java/software/amazon/awssdk/v2migrationtests/TestUtils.java b/test/v2-migration-tests/src/test/java/software/amazon/awssdk/v2migrationtests/TestUtils.java index efabf2a6090..601f18f005b 100644 --- a/test/v2-migration-tests/src/test/java/software/amazon/awssdk/v2migrationtests/TestUtils.java +++ b/test/v2-migration-tests/src/test/java/software/amazon/awssdk/v2migrationtests/TestUtils.java @@ -18,6 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat; import java.io.IOException; +import java.io.InputStream; import java.io.UncheckedIOException; import java.net.HttpURLConnection; import java.net.Proxy; @@ -147,7 +148,14 @@ public static Result run(Path dir, String... args) { IoUtils.copy(process.getInputStream(), System.out); result.result = process.waitFor(); if (!result.wasSuccessful()) { - throw new RuntimeException("Command (" + Arrays.toString(args) + ") failed: " + result.output); + String errorMsg = null; + try (InputStream errorStream = process.getErrorStream()) { + if (errorStream != null) { + errorMsg = IoUtils.toUtf8String(errorStream); + } + } + throw new RuntimeException(String.format("Command (%s) failed of error code: %d, error message: %s", + Arrays.toString(args), result.result, errorMsg)); } } finally { process.destroy();