pkg/system: IsProcessZombie() ignore "os.ErrNotExist" errors

If the file doesn't exist, the process isn't running, so we should be able
to ignore that.

Also remove an intermediate variable.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2022-10-15 14:50:48 +02:00
parent 8d6da1e100
commit 970ad4e3c7
2 changed files with 4 additions and 4 deletions

View File

@@ -355,7 +355,6 @@ func killProcessDirectly(container *container.Container) error {
if system.IsProcessAlive(pid) {
// Since we can not kill a zombie pid, add zombie check here
isZombie, err := system.IsProcessZombie(pid)
// TODO(thaJeztah) should we ignore os.IsNotExist() here? ("/proc/<pid>/stat" will be gone if the process exited)
if err != nil {
logrus.WithError(err).WithField("container", container.ID).Warn("Container state is invalid")
return err