[cipd] Don't truncate -max-threads option
jiri truncates the last CIPD CLI option, which it assumes is
`-log-level`, in verbose mode. This is fragile and broke jiri's logging
behavior when I added `-max-threads` as the last argument *after* of
`-log-level`. Instead, append `-log-level` in non-verbose mode instead
of truncating it in verbose mode.
Bug: 38616
Change-Id: I956625a07856a29094a79d7c0fee9e4bae493aa7
diff --git a/cipd/cipd.go b/cipd/cipd.go
index c26a0a4..b66a353 100644
--- a/cipd/cipd.go
+++ b/cipd/cipd.go
@@ -401,17 +401,17 @@
"ensure",
"-ensure-file", file,
"-root", projectRoot,
- "-log-level", "warning",
"-max-threads", strconv.Itoa(jirix.CipdMaxThreads),
}
+ // If jiri is *not* running with -v, use the less verbose cipd "warning"
+ // log-level.
+ if jirix.Logger.LoggerLevel < log.DebugLevel {
+ args = append(args, "-log-level", "warning")
+ }
+
task := jirix.Logger.AddTaskMsg("Fetching CIPD packages")
defer task.Done()
- // If jiri is running with -v, change cipd log-level
- // from warning to default.
- if jirix.Logger.LoggerLevel >= log.DebugLevel {
- args = args[:len(args)-2]
- }
jirix.Logger.Debugf("Invoke cipd with %v", args)
// Construct arguments and invoke cipd for ensure file