all of this is terrible

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-11 04:09:48 -06:00
parent c877c3886d
commit 732102f794
1 changed files with 18 additions and 1 deletions

19
run.go
View File

@ -21,9 +21,25 @@ var msecDelay int = 20 // check every 20 milliseconds
// use go-cmd instead here? // use go-cmd instead here?
// exiterr.Sys().(syscall.WaitStatus) // 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 // var newfile *shell.File
func RunString(args string) bool { func RunString(args string) bool {
return false // return false
parts := strings.Split(args, " ")
return Run(parts)
} }
func Run(args []string) bool { func Run(args []string) bool {
@ -36,6 +52,7 @@ func Run(args []string) bool {
return RunPath(dir, args) return RunPath(dir, args)
} }
// run, but set the working path
func RunPath(path string, args []string) bool { func RunPath(path string, args []string) bool {
if len(args) == 0 { if len(args) == 0 {
log.Warn("command line was empty") log.Warn("command line was empty")