From 0fabed76c139737635b81ce7363cfe0ed0f95ed8 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 5 May 2021 11:45:29 -0700 Subject: [PATCH] libct/int/checkpoint_test: use kill(0) for pid check os.FindProcess never returns an error on Unix/Linux. Use kill(0) to actually check if the process exists. Signed-off-by: Kir Kolyshkin --- libcontainer/integration/checkpoint_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libcontainer/integration/checkpoint_test.go b/libcontainer/integration/checkpoint_test.go index 311e33c99..9ec03b92d 100644 --- a/libcontainer/integration/checkpoint_test.go +++ b/libcontainer/integration/checkpoint_test.go @@ -11,6 +11,7 @@ import ( "testing" "github.com/opencontainers/runc/libcontainer" + "golang.org/x/sys/unix" ) func showFile(t *testing.T, fname string) error { @@ -189,7 +190,7 @@ func testCheckpoint(t *testing.T, userns bool) { pid, err = restoreProcessConfig.Pid() ok(t, err) - _, err = os.FindProcess(pid) + err = unix.Kill(pid, 0) ok(t, err) _, err = restoreStdinW.WriteString("Hello!")