SIGINT is now captured. Linux/MacOS shutdown for pcpdumptext child

processes added to clean up after we finish running. Made all tasks
run on bridged network mode so that benchmarks that heavily utilize
network are protected from eachother. I.e: Tradebeans, tradesoap
This commit is contained in:
Renan DelValle 2016-10-07 20:47:59 -04:00
parent 5dd64f1e16
commit 8f9b29cbcb
2 changed files with 26 additions and 11 deletions

View file

@ -6,11 +6,13 @@ import (
"os/exec"
"time"
"os"
"syscall"
)
func Start(quit chan struct{}, logging *bool, prefix string) {
const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c config"
cmd := exec.Command("sh", "-c", pcpCommand)
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
startTime := time.Now().Format("20060102150405")
@ -76,16 +78,16 @@ func Start(quit chan struct{}, logging *bool, prefix string) {
log.Fatal(err)
}
pgid, err := syscall.Getpgid(cmd.Process.Pid)
select{
case <- quit:
log.Println("Stopping PCP logging in 5 seconds")
time.Sleep(5 * time.Second)
cmd.Process.Kill()
// http://stackoverflow.com/questions/22470193/why-wont-go-kill-a-child-process-correctly
// kill process and all children processes
syscall.Kill(-pgid, 15)
return
}
/*
if err := cmd.Wait(); err != nil {
log.Fatal(err)
}*/
}