merge go-process

This commit is contained in:
Ethan Buchman
2017-04-18 16:33:44 -04:00
parent 5b4dcddb59
commit 6f49ba4c3e
3 changed files with 0 additions and 193 deletions

22
process/util.go Normal file
View File

@ -0,0 +1,22 @@
package process
import (
. "github.com/tendermint/go-common"
)
// Runs a command and gets the result.
func Run(dir string, command string, args []string) (string, bool, error) {
outFile := NewBufferCloser(nil)
proc, err := StartProcess("", dir, command, args, nil, outFile)
if err != nil {
return "", false, err
}
<-proc.WaitCh
if proc.ExitState.Success() {
return string(outFile.Bytes()), true, nil
} else {
return string(outFile.Bytes()), false, nil
}
}