This commit is contained in:
Jack Danger 2026-04-17 19:10:54 -04:00 committed by GitHub
commit 1e028b438d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -373,7 +373,6 @@ func run(ctx context.Context, args RunArgs) ([]byte, error) {
}()
}
// TODO: Impose limits on command output size.
// TODO: Set environment to get English error messages.
var stderr bytes.Buffer
var stdout bytes.Buffer
c := exec.CommandContext(ctx, cmd[0], cmd[1:]...)
@ -382,7 +381,11 @@ func run(ctx context.Context, args RunArgs) ([]byte, error) {
c.Stdin = args.stdin
c.Stderr = &stderr
c.Stdout = &stdout
c.Env = append(c.Environ(), args.env...)
// Ensure VCS commands produce English error messages regardless of the
// user's locale, so that error message parsing in the module proxy and
// VCS code is reliable.
c.Env = append(c.Environ(), "LC_ALL=C")
c.Env = append(c.Env, args.env...)
err := c.Run()
if err != nil {
err = &RunError{Cmd: strings.Join(cmd, " ") + " in " + args.dir, Stderr: stderr.Bytes(), Err: err}