Merge pull request #431 from LK4D4/fix_nsenter_test_hang
Remove overcomplicated logic of SIGCHLD from TestNsenterDeadPid
This commit is contained in:
commit
d4867a6583
|
@ -5,9 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/signal"
|
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -67,16 +65,10 @@ func TestNsenterInvalidPid(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNsenterDeadPid(t *testing.T) {
|
func TestNsenterDeadPid(t *testing.T) {
|
||||||
|
|
||||||
c := make(chan os.Signal)
|
|
||||||
signal.Notify(c, syscall.SIGCHLD)
|
|
||||||
dead_cmd := exec.Command("true")
|
dead_cmd := exec.Command("true")
|
||||||
if err := dead_cmd.Start(); err != nil {
|
if err := dead_cmd.Run(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
defer dead_cmd.Wait()
|
|
||||||
<-c // dead_cmd is zombie
|
|
||||||
|
|
||||||
args := []string{"nsenter-exec"}
|
args := []string{"nsenter-exec"}
|
||||||
|
|
||||||
cmd := &exec.Cmd{
|
cmd := &exec.Cmd{
|
||||||
|
|
Loading…
Reference in New Issue