Skip to content

Commit

Permalink
Merge pull request #2716 from kolyshkin/fix-warn
Browse files Browse the repository at this point in the history
libct: suppress bogus "unable to terminate" warnings
  • Loading branch information
Mrunal Patel authored Jan 22, 2021
2 parents 066ac18 + 72f4638 commit c69ae75
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions libcontainer/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -2067,9 +2067,20 @@ func ignoreTerminateErrors(err error) error {
if err == nil {
return nil
}
// terminate() might return an error from ether Kill or Wait.
// The (*Cmd).Wait documentation says: "If the command fails to run
// or doesn't complete successfully, the error is of type *ExitError".
// Filter out such errors (like "exit status 1" or "signal: killed").
var exitErr *exec.ExitError
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.

s := err.Error()
if strings.Contains(s, "signal: killed") ||
strings.Contains(s, "process already finished") ||
if strings.Contains(s, "process already finished") ||
strings.Contains(s, "Wait was already called") {
return nil
}
Expand Down

0 comments on commit c69ae75

Please sign in to comment.