Skip to content

Commit

Permalink
chore: wrap log.Println in cmd with verbose check (#399)
Browse files Browse the repository at this point in the history
Co-authored-by: Nate Finch <nate.finch@gmail.com>
  • Loading branch information
viktorvoltaire and natefinch committed Jan 16, 2022
1 parent 0873a9b commit 3a11bce
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 3a11bce

Please sign in to comment.