refs #2553 Improve exception handling
parent
78cdba9aa7
commit
5c6206bafa
|
@ -41,7 +41,7 @@ class FilesystemLibrary:
|
|||
try:
|
||||
with open(file, "r", encoding='utf-8') as f:
|
||||
data = f.read()
|
||||
except IOError as io_err:
|
||||
except Exception as io_err:
|
||||
self.logger.debug("IO Error reading file %s: %s", file, io_err)
|
||||
|
||||
return data
|
||||
|
@ -51,7 +51,7 @@ class FilesystemLibrary:
|
|||
|
||||
try:
|
||||
data = os.readlink(file)
|
||||
except IOError as io_err:
|
||||
except Exception as io_err:
|
||||
self.logger.debug("IO Error reading link %s: %s", file, io_err)
|
||||
|
||||
return data
|
||||
|
@ -106,13 +106,16 @@ class FilesystemLibrary:
|
|||
self.logger.debug("PID %s (%s) is has a working directory within %s: %s", pid_dir, command_name, path, working_dir)
|
||||
pids_using_path[pid_dir] = { "cmd" : command_name, "args" : cmdline}
|
||||
else:
|
||||
for fd_file in os.listdir(fd_path):
|
||||
fd_file_full_path = os.path.join(fd_path, fd_file)
|
||||
target = self._read_link(fd_file_full_path)
|
||||
try:
|
||||
for fd_file in os.listdir(fd_path):
|
||||
fd_file_full_path = os.path.join(fd_path, fd_file)
|
||||
target = self._read_link(fd_file_full_path)
|
||||
|
||||
if target.startswith(path):
|
||||
self.logger.debug("PID %s (%s) is has an open file within %s: %s", pid_dir, command_name, path, target)
|
||||
pids_using_path[pid_dir] = { "cmd" : command_name, "args" : cmdline}
|
||||
if target.startswith(path):
|
||||
self.logger.debug("PID %s (%s) is has an open file within %s: %s", pid_dir, command_name, path, target)
|
||||
pids_using_path[pid_dir] = { "cmd" : command_name, "args" : cmdline}
|
||||
except IOError as ioerr:
|
||||
self.logger.warning("Exception during listdir: %s", ioerr)
|
||||
|
||||
return pids_using_path
|
||||
|
||||
|
|
Loading…
Reference in New Issue