Commit bd8f4ff8 authored by Bryan Boreham's avatar Bryan Boreham Committed by Bryan Boreham

Send SIGTERM on Pdeathsig to allow child to clean up

Also fix the comment to better describe the effect of this code.
parent ba17bac8
...@@ -295,12 +295,12 @@ func (es *e2eService) startServer(cmd *healthCheckCommand) error { ...@@ -295,12 +295,12 @@ func (es *e2eService) startServer(cmd *healthCheckCommand) error {
cmd.Cmd.Stdout = outfile cmd.Cmd.Stdout = outfile
cmd.Cmd.Stderr = outfile cmd.Cmd.Stderr = outfile
// Killing the sudo command should kill the server as well. // Death of this test process should kill the server as well.
attrs := &syscall.SysProcAttr{} attrs := &syscall.SysProcAttr{}
// Hack to set linux-only field without build tags. // Hack to set linux-only field without build tags.
deathSigField := reflect.ValueOf(attrs).Elem().FieldByName("Pdeathsig") deathSigField := reflect.ValueOf(attrs).Elem().FieldByName("Pdeathsig")
if deathSigField.IsValid() { if deathSigField.IsValid() {
deathSigField.Set(reflect.ValueOf(syscall.SIGKILL)) deathSigField.Set(reflect.ValueOf(syscall.SIGTERM))
} else { } else {
cmdErrorChan <- fmt.Errorf("Failed to set Pdeathsig field (non-linux build)") cmdErrorChan <- fmt.Errorf("Failed to set Pdeathsig field (non-linux build)")
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment