You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cli): fix case where linkLocalBazel fails when os.UserCacheDir returns path starting with ~ (#1182)
Also run `help flags-as-proto` command in a UserCacheDir() location
instead of the tmp dir and fix order of error handling for the result of
that call. UserCacheDir() is more robust since tmpdir is not guaranteed
to exist or to be writable (as per [golang
docs](https://pkg.go.dev/os#TempDir)). We already depend on
UserCacheDir() in the CLI code.
GitOrigin-RevId: df084e1effce5ba4a813f56b33260e9749c5526d
returnnil, fmt.Errorf("failed to get bazel flags: %w", fmt.Errorf("bazel has quit with code %d\nstderr:\n%s", exitCode, stderr.String()))
188
-
}
202
+
}(tmpdir)
189
203
190
204
iferr:=<-bazelErrs; err!=nil {
191
205
returnnil, fmt.Errorf("failed to get bazel flags: %w", err)
192
206
}
193
207
208
+
ifexitCode:=<-bazelExitCode; exitCode!=0 {
209
+
returnnil, fmt.Errorf("failed to get bazel flags running in %s: %w", tmpdir, fmt.Errorf("bazel has quit with code %d\nstderr:\n%s", exitCode, stderr.String()))
210
+
}
211
+
194
212
helpProtoBytes, err:=io.ReadAll(stdoutDecoder)
195
213
iferr!=nil {
196
214
returnnil, fmt.Errorf("failed to get bazel flags: %w", err)
0 commit comments