X Tutup
Skip to content

Commit c87dc00

Browse files
committed
Omit the full path of a command in DEBUG mode
1 parent 5b4a08d commit c87dc00

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/run/run.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"os"
77
"os/exec"
8+
"path/filepath"
89
"strings"
910
)
1011

@@ -42,7 +43,9 @@ type cmdWithStderr struct {
4243

4344
func (c cmdWithStderr) Output() ([]byte, error) {
4445
if os.Getenv("DEBUG") != "" {
45-
fmt.Fprintf(os.Stderr, "%v\n", c.Cmd.Args)
46+
// print commands, but omit the full path to an executable
47+
debugArgs := append([]string{filepath.Base(c.Cmd.Args[0])}, c.Cmd.Args[1:]...)
48+
fmt.Fprintf(os.Stderr, "%v\n", debugArgs)
4649
}
4750
if c.Cmd.Stderr != nil {
4851
return c.Cmd.Output()

0 commit comments

Comments
 (0)
X Tutup