Skip to content

Commit

Permalink
pkg/expect: sends SIGTERM to the cmd process on close()
Browse files Browse the repository at this point in the history
etcd process won't terminateon SIGINT
but will on SIGTERM if test is run as a background process.
related issue etcd-io#725.
  • Loading branch information
fanminshi committed Feb 17, 2017
1 parent e373022 commit 29b1b3f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/expect/expect.go
Expand Up @@ -23,6 +23,7 @@ import (
"os/exec"
"strings"
"sync"
"syscall"

"github.com/kr/pty"
)
Expand Down Expand Up @@ -140,7 +141,9 @@ func (ep *ExpectProcess) close(kill bool) error {
return ep.err
}
if kill {
ep.Signal(os.Interrupt)
// go runtime ignores SIGINT but not SIGTERM
// if e2e test is run as a background process.
ep.Signal(syscall.SIGTERM)
}

err := ep.cmd.Wait()
Expand Down

0 comments on commit 29b1b3f

Please sign in to comment.