diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-21 21:45:18 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-21 22:07:14 +1100 |
commit | 67a446234c678fe56f1c209b8b75d511cc2d1d94 (patch) | |
tree | 1a71258b415351b06ac49b2d002f855b5a8f0174 /pkg/commands/os.go | |
parent | f905b27b00d827c6745824c5b45c06188313344e (diff) |
fix specs
Diffstat (limited to 'pkg/commands/os.go')
-rw-r--r-- | pkg/commands/os.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/commands/os.go b/pkg/commands/os.go index 8f49483c6..e421c4e6a 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -59,9 +59,11 @@ func (c *OSCommand) SetCommand(cmd func(string, ...string) *exec.Cmd) { } // RunCommandWithOutput wrapper around commands returning their output and error +// NOTE: because this takes a format string followed by format args, you'll need +// to escape any percentage signs via '%%'. func (c *OSCommand) RunCommandWithOutput(formatString string, formatArgs ...interface{}) (string, error) { command := formatString - if len(formatArgs) > 0 { + if formatArgs != nil { command = fmt.Sprintf(formatString, formatArgs...) } c.Log.WithField("command", command).Info("RunCommand") |