Skip to content

Commit

Permalink
modified: watchpid_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
nbari committed Jul 22, 2016
1 parent fc33119 commit fe1f800
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions watchpid_test.go
Expand Up @@ -2,6 +2,7 @@ package immortal

import (
"os/exec"
"syscall"
"testing"
"time"
)
Expand Down Expand Up @@ -29,11 +30,14 @@ func TestWatchPidGetpid(t *testing.T) {
D.watchPid(pid, ch)
ch <- cmd.Wait()
}()

err := <-ch
if err != nil {
if err.Error() != "EXIT" {
t.Error(err)
select {
case <-time.After(time.Millisecond):
syscall.Kill(pid, syscall.SIGTERM)
case err := <-ch:
if err != nil {
if err.Error() != "EXIT" {
t.Error(err)
}
}
}
}
Expand Down

0 comments on commit fe1f800

Please sign in to comment.