From c5238610a7d471ded9cf01c3de907624bbe6e31c Mon Sep 17 00:00:00 2001 From: Gwen Dawes Date: Fri, 26 Jul 2024 13:38:34 +0100 Subject: [PATCH] Silently ignore OSError on close --- rtslib/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rtslib/utils.py b/rtslib/utils.py index 692d578..570113c 100644 --- a/rtslib/utils.py +++ b/rtslib/utils.py @@ -115,7 +115,10 @@ def is_dev_in_use(path): except OSError: return True else: - os.close(file_fd) + try: + os.close(file_fd) + except OSError: + pass return False def _get_size_for_dev(device):