|
|
@ -44,6 +44,8 @@ func GetUniqueIDFromIPPort(ip, port string) uint16 { |
|
|
|
// RunCmd runs command `name` with arguments `args`
|
|
|
|
// RunCmd runs command `name` with arguments `args`
|
|
|
|
func RunCmd(name string, args ...string) error { |
|
|
|
func RunCmd(name string, args ...string) error { |
|
|
|
cmd := exec.Command(name, args...) |
|
|
|
cmd := exec.Command(name, args...) |
|
|
|
|
|
|
|
stderrBytes := &bytes.Buffer{} |
|
|
|
|
|
|
|
cmd.Stderr = stderrBytes |
|
|
|
if err := cmd.Start(); err != nil { |
|
|
|
if err := cmd.Start(); err != nil { |
|
|
|
log.Fatal(err) |
|
|
|
log.Fatal(err) |
|
|
|
return err |
|
|
|
return err |
|
|
@ -53,6 +55,7 @@ func RunCmd(name string, args ...string) error { |
|
|
|
go func() { |
|
|
|
go func() { |
|
|
|
if err := cmd.Wait(); err != nil { |
|
|
|
if err := cmd.Wait(); err != nil { |
|
|
|
log.Printf("Command finished with error: %v", err) |
|
|
|
log.Printf("Command finished with error: %v", err) |
|
|
|
|
|
|
|
log.Printf("Stderr: %v", string(stderrBytes.Bytes())) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
log.Printf("Command finished successfully") |
|
|
|
log.Printf("Command finished successfully") |
|
|
|
} |
|
|
|
} |
|
|
|