diff --git a/Sources/tart/Credentials/DockerConfigCredentialsProvider.swift b/Sources/tart/Credentials/DockerConfigCredentialsProvider.swift index e510282..7c5ba53 100644 --- a/Sources/tart/Credentials/DockerConfigCredentialsProvider.swift +++ b/Sources/tart/Credentials/DockerConfigCredentialsProvider.swift @@ -41,13 +41,18 @@ class DockerConfigCredentialsProvider: CredentialsProvider { process.waitUntilExit() + let outputData = try outPipe.fileHandleForReading.readToEnd() if !(process.terminationReason == .exit && process.terminationStatus == 0) { + if let outputData = outputData { + print(String(decoding: outputData, as: UTF8.self)) + } throw CredentialsProviderError.Failed(message: "Docker helper failed!") } + if outputData == nil || outputData?.count == 0 { + throw CredentialsProviderError.Failed(message: "Docker helper output is empty!") + } - let getOutput = try JSONDecoder().decode( - DockerGetOutput.self, from: outPipe.fileHandleForReading.readDataToEndOfFile() - ) + let getOutput = try JSONDecoder().decode(DockerGetOutput.self, from: outputData!) return (getOutput.Username, getOutput.Secret) }