Yet another wrapper of os/exec
The recommended way to install go-command
go get github.com/mcuadros/go-command
How import the package
import (
"github.com/mcuadros/go-command"
)
Basic example:
cmd := NewCommand("./test", "-exit=0", "-time=1", "-max=1")
if err := cmd.Run(); err != nil {
panic(err)
}
if err := cmd.Wait(); err != nil {
panic(err)
}
response := cmd.GetResponse()
fmt.Printf("Failed: %v, ExitCode: %d, Elapsed: %s",
response.Failed,
response.ExitCode,
response.RealTime,
)
//Return: Failed: false, ExitCode: 0, RealTime: 1.004233166s
MIT, see LICENSE