Skip to content

Commit

Permalink
who holds the file ???
Browse files Browse the repository at this point in the history
  • Loading branch information
euri10 committed Nov 9, 2023
1 parent cad297c commit 5c08bd0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions johnnycanencrypt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,17 @@ def get_pid_using_file(file_path):
try:
if proc.info['open_files'] is not None:
if file_path in [file.path for file in proc.info['open_files']]:
return proc.info['pid']
print(proc.info)
return proc.info['pid'], proc.info['name']
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass
except Exception as e:
print(f"Error: {e}")
return None

pid_using_file = get_pid_using_file(self.dbpath)
pid_using_file, name = get_pid_using_file(self.dbpath)
print(pid_using_file)
print(name)
os.rename(self.dbpath, oldpath)
self.dbpath = oldpath

Expand Down

0 comments on commit 5c08bd0

Please sign in to comment.