Skip to content

Commit 845e5dd

Browse files
authored
Merge pull request #409 from sapcc/git-error
Show stderr from commands
2 parents 6694688 + 03e8eb8 commit 845e5dd

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

internal/core/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package core
55

66
import (
77
_ "embed"
8+
"os"
89
"os/exec"
910
"slices"
1011
"strings"
@@ -318,7 +319,9 @@ func (c *Configuration) Validate() {
318319
// Validate global options.
319320
if ghwCfg.Global.DefaultBranch == "" {
320321
errMsg := "could not find default branch using git, you can define it manually by setting 'githubWorkflow.global.defaultBranch' in config"
321-
b, err := exec.Command("git", "symbolic-ref", "refs/remotes/origin/HEAD").CombinedOutput()
322+
cmd := exec.Command("git", "symbolic-ref", "refs/remotes/origin/HEAD")
323+
cmd.Stderr = os.Stderr
324+
b, err := cmd.Output()
322325
if err != nil {
323326
logg.Fatal("%s: %s", errMsg, err.Error())
324327
}

internal/renovate/renovate.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ func RenderConfig(cfg core.Configuration, scanResult golang.ScanResult) {
181181
} else {
182182
logg.Debug("-> running renovate-config-validator")
183183
cmd := exec.Command(validator)
184-
output, err := cmd.CombinedOutput()
184+
cmd.Stderr = os.Stderr
185+
output, err := cmd.Output()
185186
if err != nil {
186187
logg.Fatal(string(output))
187188
}

internal/reuse/reuse.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ func RenderConfig(cfg core.Configuration, sr golang.ScanResult) {
4949
// otherwise we might miss some direct dependencies which is really strange...
5050
logg.Debug("-> running go-mod-tidy")
5151
cmd := exec.Command("go", "mod", "tidy")
52-
output, err := cmd.CombinedOutput()
52+
cmd.Stderr = os.Stderr
53+
output, err := cmd.Output()
5354
if err != nil {
5455
logg.Fatal(string(output))
5556
}

0 commit comments

Comments
 (0)