You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
479 B

  1. package process
  2. import (
  3. . "github.com/tendermint/tmlibs/common"
  4. )
  5. // Runs a command and gets the result.
  6. func Run(dir string, command string, args []string) (string, bool, error) {
  7. outFile := NewBufferCloser(nil)
  8. proc, err := StartProcess("", dir, command, args, nil, outFile)
  9. if err != nil {
  10. return "", false, err
  11. }
  12. <-proc.WaitCh
  13. if proc.ExitState.Success() {
  14. return string(outFile.Bytes()), true, nil
  15. } else {
  16. return string(outFile.Bytes()), false, nil
  17. }
  18. }