summaryrefslogtreecommitdiff
path: root/shell.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-03-01 21:45:30 -0600
committerJeff Carr <[email protected]>2024-03-01 21:45:30 -0600
commit1ff1045445ecfb9b4a7f122d46436fcfcdd1b150 (patch)
treed70da4479795bcce3953502d19126e826571532c /shell.go
parentdf4554955832599714f6cf77c40055ebaa85aac1 (diff)
start fixing all this old junkv0.22.0v0.21.2
Diffstat (limited to 'shell.go')
-rw-r--r--shell.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/shell.go b/shell.go
index faaad07..21982af 100644
--- a/shell.go
+++ b/shell.go
@@ -165,6 +165,21 @@ func Exec(cmdline string) {
os.Exit(0)
}
+func NewRun(workingpath string, cmd []string) error {
+ log.Log(INFO, "NewRun() ", cmd)
+
+ process := exec.Command(cmd[0], cmd[1:len(cmd)]...)
+ // Set the working directory
+ process.Dir = workingpath
+ process.Stderr = os.Stderr
+ process.Stdin = os.Stdin
+ process.Stdout = os.Stdout
+ process.Start()
+ err := process.Wait()
+ log.Log(INFO, "shell.Exec() err =", err)
+ return err
+}
+
// return true if the filename exists (cross-platform)
func Exists(filename string) bool {
_, err := os.Stat(Path(filename))