Browse Source

server/process: Don't show tracebacks if the lockfile is removed

lsof/fuser error if the file doesn't exist. It can be deleted by something
else so ignore this if it happens and loop.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Richard Purdie 3 years ago
parent
commit
b100d22ce3
1 changed files with 6 additions and 0 deletions
  1. 6 0
      lib/bb/server/process.py

+ 6 - 0
lib/bb/server/process.py

@@ -286,6 +286,9 @@ class ProcessServer():
                 procs = None
                 try:
                     procs = subprocess.check_output(["lsof", '-w', lockfile], stderr=subprocess.STDOUT)
+                except subprocess.CalledProcessError:
+                    # File was deleted?
+                    continue
                 except OSError as e:
                     if e.errno != errno.ENOENT:
                         raise
@@ -293,6 +296,9 @@ class ProcessServer():
                     # Fall back to fuser if lsof is unavailable
                     try:
                         procs = subprocess.check_output(["fuser", '-v', lockfile], stderr=subprocess.STDOUT)
+                    except subprocess.CalledProcessError:
+                        # File was deleted?
+                        continue
                     except OSError as e:
                         if e.errno != errno.ENOENT:
                             raise