diff --git a/cmd.go b/cmd.go index 907a67f..3a72232 100644 --- a/cmd.go +++ b/cmd.go @@ -48,26 +48,26 @@ func PathRun(path string, argv []string) cmd.Status { // the actual wrapper around go-cmd/cmd // adds a log Flag so that echo to stdout can be enabled/disabled -func PathRunLog(path string, args []string, logf *log.LogFlag) cmd.Status { +func PathRunLog(path string, argv []string, logf *log.LogFlag) cmd.Status { var save []string // combined stdout & stderr var arg0 string - var argx []string + var args []string if logf == nil { logf = NOW } - log.Log(logf, "shell.PathRunLog():", args) + log.Log(logf, "shell.PathRunLog() Path =", path, "cmd =", argv) // Check if the slice has at least one element (the command name) - if len(args) == 0 { + if len(argv) == 0 { var s cmd.Status s.Error = errors.New("Error: Command slice is empty.") return s } - if len(args) == 1 { + if len(argv) == 1 { // Pass the first element as the command, and the rest as variadic arguments - arg0 = args[0] + arg0 = argv[0] } else { - arg0 = args[0] - argx = args[1:] + arg0 = argv[0] + args = argv[1:] } // Disable output buffering, enable streaming @@ -77,7 +77,7 @@ func PathRunLog(path string, args []string, logf *log.LogFlag) cmd.Status { } // Create Cmd with options - envCmd := cmd.NewCmdOptions(cmdOptions, arg0, argx...) + envCmd := cmd.NewCmdOptions(cmdOptions, arg0, args...) if path != "" { // set the path for exec envCmd.Dir = path