diff options
| author | Jeff Carr <[email protected]> | 2024-11-13 11:56:25 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-13 11:56:25 -0600 |
| commit | bc31c854139017baeb738bac9e591354d66ffabc (patch) | |
| tree | 112bde7bb0f403be215f8a28f1582ff1cba31af3 | |
| parent | d986f8f33181d892c2dd220c145863fc3fe6ce14 (diff) | |
rename args argvv0.22.6
| -rw-r--r-- | cmd.go | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -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 |
