OSDN Git Service

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