diff --git a/src/main/kotlin/io/github/georgberky/maven/plugins/depsupdate/NativeGitProvider.kt b/src/main/kotlin/io/github/georgberky/maven/plugins/depsupdate/NativeGitProvider.kt index 7cb5955..f78ba1c 100644 --- a/src/main/kotlin/io/github/georgberky/maven/plugins/depsupdate/NativeGitProvider.kt +++ b/src/main/kotlin/io/github/georgberky/maven/plugins/depsupdate/NativeGitProvider.kt @@ -57,21 +57,25 @@ open class NativeGitProvider(val localRepositoryDirectory: Path) : GitProvider { if(returnValue != 0) { throw ProcessException("Native git invocation failed. " + "Command: ${command.joinToString(" ")}, " + - "return value was: $returnValue") + "return value was: $returnValue\n" + + "stdout was: ${result.second}\n" + + "stderr was: ${result.third}") } - return result + return Pair(returnValue, result.second) } - open fun run(vararg command: String): Pair { + open fun run(vararg command: String): Triple { val process = ProcessBuilder(*command) .directory(localRepositoryDirectory.toFile()) .start() val returnValue = process.waitFor() - val processOutput = IOUtils.toString(process.inputStream) - return Pair(returnValue, processOutput) + val processOutput = IOUtils.toString(process.inputStream, StandardCharsets.UTF_8) + val processErr = IOUtils.toString(process.errorStream, StandardCharsets.UTF_8) + + return Triple(returnValue, processOutput, processErr) } class ProcessException(message: String?) : RuntimeException(message) { diff --git a/src/test/kotlin/io/github/georgberky/maven/plugins/depsupdate/NativeGitProviderErrorHandlingTest.kt b/src/test/kotlin/io/github/georgberky/maven/plugins/depsupdate/NativeGitProviderErrorHandlingTest.kt index 710a266..defa22c 100644 --- a/src/test/kotlin/io/github/georgberky/maven/plugins/depsupdate/NativeGitProviderErrorHandlingTest.kt +++ b/src/test/kotlin/io/github/georgberky/maven/plugins/depsupdate/NativeGitProviderErrorHandlingTest.kt @@ -18,8 +18,8 @@ internal class NativeGitProviderErrorHandlingTest { @BeforeEach internal fun setUp() { gitProvider = object : NativeGitProvider(tempDir.toPath()) { - override fun run(vararg command: String): Pair { - return Pair(returnValue, processOutput) + override fun run(vararg command: String): Triple { + return Triple(returnValue, processOutput, "") } } }