Skip to content

Commit

Permalink
libcontainer/ignoreTerminateErrors: simplify for Go 1.16+
Browse files Browse the repository at this point in the history
One less TODO in the code, yay!

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed Oct 14, 2021
1 parent 12e99a0 commit 6a4f4a6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions libcontainer/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6a4f4a6

Please sign in to comment.