error output fix

This commit is contained in:
Brian Hendriks
2024-09-16 12:47:02 -07:00
parent c56dd8bda1
commit 7070471f7a
+5
View File
@@ -75,6 +75,11 @@ func execGpgAndReadOutput(ctx context.Context, in []byte, args []string) (*bytes
if state.Exited() {
if state.ExitCode() != 0 {
waitErr := eg.Wait()
if waitErr != nil {
return nil, nil, fmt.Errorf("failed to read output for command '%s': %w", cmdStr, waitErr)
}
return nil, nil, fmt.Errorf("command '%s' exited with code %d. stdout: '%s', stderr: '%s'", cmdStr, state.ExitCode(), outBuf.String(), errBuf.String())
}