diff options
| author | Jeff Carr <[email protected]> | 2025-02-14 18:40:31 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-14 18:40:31 -0600 |
| commit | 2b1f7f54d5585d69c4372f0005ecdd2db5351000 (patch) | |
| tree | ddf27a03bc4be7e40ae6d4cc090c7c0c07f0116d /exec.go | |
| parent | d70cf82ecc02c5be472c87e2923fab7188f2cdbd (diff) | |
testing for using 'sudo'v0.22.26
Diffstat (limited to 'exec.go')
| -rw-r--r-- | exec.go | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -49,6 +49,28 @@ func ExecCheck(args []string) error { return nil } +func PathExecVerbose(path string, args []string) error { + if len(args) == 0 { + return errors.New("Error: Command slice is empty.") + } + + // Start a long-running process, capture stdout and stderr + a, b := RemoveFirstElement(args) + + process := exec.Command(a, b...) + process.Dir = path + process.Stderr = os.Stderr + process.Stdin = os.Stdin + process.Stdout = os.Stdout + err := process.Run() + if err != nil { + log.Info("ExecCheck() err", err) + return err + } + // log.Info("ExecCheck() nil") + return nil +} + func SudoRaw(c []string) { args := []string{"-S"} args = append(args, c...) |
