summaryrefslogtreecommitdiffstats
path: root/pkg/commands/os.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/os.go')
-rw-r--r--pkg/commands/os.go4
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")