summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--run.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/run.go b/run.go
index ed62f61..4e03ac2 100644
--- a/run.go
+++ b/run.go
@@ -21,9 +21,25 @@ var msecDelay int = 20 // check every 20 milliseconds
// use go-cmd instead here?
// exiterr.Sys().(syscall.WaitStatus)
+// run command and return it's output
+func RunCapture(cmdline string) string {
+ test := New()
+ test.Exec(cmdline)
+ return Chomp(test.Buffer)
+}
+
+func RunWait(args []string) *Shell {
+ test := New()
+ cmdline := strings.Join(args, " ")
+ test.Exec(cmdline)
+ return test
+}
+
// var newfile *shell.File
func RunString(args string) bool {
- return false
+ // return false
+ parts := strings.Split(args, " ")
+ return Run(parts)
}
func Run(args []string) bool {
@@ -36,6 +52,7 @@ func Run(args []string) bool {
return RunPath(dir, args)
}
+// run, but set the working path
func RunPath(path string, args []string) bool {
if len(args) == 0 {
log.Warn("command line was empty")