Skip to content

Commit

Permalink
chore: wrap log.Println in cmd with verbose check
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Voltaire committed Dec 23, 2021
1 parent 2f1ec40 commit c8c44bc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sh/cmd.go
Expand Up @@ -137,7 +137,10 @@ func run(env map[string]string, stdout, stderr io.Writer, cmd string, args ...st
for i := range args {
quoted = append(quoted, fmt.Sprintf("%q", args[i]));
}
log.Println("exec:", cmd, strings.Join(quoted, " "))
// To protect against logging from doing exec in global variables
if mg.Verbose() {
log.Println("exec:", cmd, strings.Join(quoted, " "))
}
err = c.Run()
return CmdRan(err), ExitStatus(err), err
}
Expand Down

0 comments on commit c8c44bc

Please sign in to comment.