summaryrefslogtreecommitdiff
path: root/exec.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-14 18:40:31 -0600
committerJeff Carr <[email protected]>2025-02-14 18:40:31 -0600
commit2b1f7f54d5585d69c4372f0005ecdd2db5351000 (patch)
treeddf27a03bc4be7e40ae6d4cc090c7c0c07f0116d /exec.go
parentd70cf82ecc02c5be472c87e2923fab7188f2cdbd (diff)
testing for using 'sudo'v0.22.26
Diffstat (limited to 'exec.go')
-rw-r--r--exec.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/exec.go b/exec.go
index c5fb298..49294d2 100644
--- a/exec.go
+++ b/exec.go
@@ -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...)