[cipd] Suppress `cipd ensure-file-verify` output
Modifying log-level is not sufficient to prevent the command from
spamming during successful operation.
Change-Id: I15ac46b2ad7c28278f888a98df57ef55bec7cd63
Reviewed-on: https://fuchsia-review.googlesource.com/c/jiri/+/447898
Fuchsia-Auto-Submit: Nathan Mulcahey <nmulcahey@google.com>
Reviewed-by: Roland McGrath <mcgrathr@google.com>
Commit-Queue: Nathan Mulcahey <nmulcahey@google.com>
diff --git a/cipd/cipd.go b/cipd/cipd.go
index 6598771..aa4db79 100644
--- a/cipd/cipd.go
+++ b/cipd/cipd.go
@@ -454,13 +454,17 @@
// Construct arguments and invoke cipd for ensure file
command := exec.Command(cipdPath, args...)
+ var stdoutBuf, stderrBuf bytes.Buffer
// Add User-Agent info for cipd
command.Env = append(os.Environ(), "CIPD_HTTP_USER_AGENT_PREFIX="+getUserAgent())
command.Stdin = os.Stdin
- command.Stdout = os.Stdout
- command.Stderr = os.Stderr
+ // Redirect outputs since cipd will print verbose information even
+ // if log-level is set to warning
+ command.Stdout = &stdoutBuf
+ command.Stderr = &stderrBuf
if err := command.Run(); err != nil {
+ jirix.Logger.Errorf("`cipd ensure-file-verify` failed: stdout: %s\nstderr: %s", stdoutBuf.String(), stderrBuf.String())
return cipdManifestInvalidErr
}