mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:51:43 +00:00
Closes [#1110](https://github.com/sourcegraph/devx-support/issues/1110) Closes DINF-96 We don't print the stdErr when a command fails … in particular when git fails. Therefore we see very little in the panic of what went wrong. Explanation: > There's a weird behavior that occurs where an error isn't accessible in the err variable // from a *Cmd executing a git command after calling CombinedOutput(). // This occurs due to how Git handles errors and how the exec package in Go interprets the command's output. // Git often writes error messages to stderr, but it might still exit with a status code of 0 (indicating success). // In this case, CombinedOutput() won't return an error, but the error message will be in the out variable. ## Test plan Manual testing ```go func main() { ctx := context.Background() cmd := exec.CommandContext(ctx, "git", "rev-parse", "--is-inside-work-tree") out, err := handleGitCommandExec(cmd) if err != nil { // er := errors.Wrap(err, fmt.Sprintf("idsdsd: %s", string(out))) panic(err) } fmt.Println("hello", string(out)) } ``` ## Changelog <!-- OPTIONAL; info at https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c -->
15 lines
369 B
Python
15 lines
369 B
Python
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
|
|
|
go_library(
|
|
name = "gitops",
|
|
srcs = ["git_ops.go"],
|
|
importpath = "github.com/sourcegraph/sourcegraph/dev/ci/gitops",
|
|
tags = [TAG_INFRA_DEVINFRA],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//internal/execute",
|
|
"//internal/oobmigration",
|
|
"//lib/errors",
|
|
],
|
|
)
|