[gcs-util] Output stderr when running blobfs-compression

This is useful for debugging when blobfs-compression says the delivery
blob is invalid.

Change-Id: I8f30cb8c13cc0a3cbd82c23142760f1ee94df725
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/infra/+/860806
Fuchsia-Auto-Submit: Anthony Fandrianto <atyfto@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Reviewed-by: Sen Jiang <senj@google.com>
diff --git a/cmd/gcs-util/verify_blobs.go b/cmd/gcs-util/verify_blobs.go
index 543120e..7820737 100644
--- a/cmd/gcs-util/verify_blobs.go
+++ b/cmd/gcs-util/verify_blobs.go
@@ -5,6 +5,7 @@
 package main
 
 import (
+	"bytes"
 	"context"
 	"encoding/json"
 	"errors"
@@ -100,11 +101,14 @@
 // runBlobfsCompression runs the blobfs-compression tool to get the merkle root
 // of the given blob.
 func runBlobfsCompression(blob types.Upload, tool string) (string, error) {
-	stdout, err := exec.Command(tool, fmt.Sprintf("--calculate_digest=%s", blob.Source)).Output()
-	if err != nil {
-		return "", fmt.Errorf("could not compute merkle root of blob %s: %w", blob.Source, err)
+	var stdout, stderr bytes.Buffer
+	cmd := exec.Command(tool, fmt.Sprintf("--calculate_digest=%s", blob.Source))
+	cmd.Stdout = &stdout
+	cmd.Stderr = &stderr
+	if err := cmd.Run(); err != nil {
+		return "", fmt.Errorf("could not compute merkle root of blob %s: %w\n%s", blob.Source, err, stderr.String())
 	}
-	return strings.TrimSuffix(string(stdout), "\n"), nil
+	return strings.TrimSuffix(stdout.String(), "\n"), nil
 }
 
 // verifyBlobs checks that the merkle root of each blob is equal to its