From 6a4f4a6a370383365f2ae9d515e94a784be85bb8 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 13 Oct 2021 12:45:54 -0700 Subject: [PATCH] libcontainer/ignoreTerminateErrors: simplify for Go 1.16+ One less TODO in the code, yay! Signed-off-by: Kir Kolyshkin --- libcontainer/container_linux.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go index df78a950f..d0969a27c 100644 --- a/libcontainer/container_linux.go +++ b/libcontainer/container_linux.go @@ -2150,13 +2150,11 @@ func ignoreTerminateErrors(err error) error { if errors.As(err, &exitErr) { return nil } - // TODO: use errors.Is(err, os.ErrProcessDone) here and - // remove "process already finished" string comparison below - // once go 1.16 is minimally supported version. - + if errors.Is(err, os.ErrProcessDone) { + return nil + } s := err.Error() - if strings.Contains(s, "process already finished") || - strings.Contains(s, "Wait was already called") { + if strings.Contains(s, "Wait was already called") { return nil } return err