mirror of
https://github.com/1j01/textual-paint.git
synced 2024-11-24 08:44:45 +03:00
Skip invalid file descriptors
This commit is contained in:
parent
00decf8217
commit
2a3c3f2d1d
@ -53,6 +53,10 @@ def restart_program() -> None:
|
||||
else:
|
||||
p = psutil.Process(os.getpid())
|
||||
for handler in p.open_files() + p.connections():
|
||||
if handler.fd == -1:
|
||||
# On Windows, this happens for kernel32.dll.mui, KernelBase.dll.mui, and about 4 sockets. Dunno man.
|
||||
# print("Skipping invalid file descriptor (-1) for:", handler)
|
||||
continue
|
||||
try:
|
||||
os.close(handler.fd)
|
||||
except Exception as e:
|
||||
|
Loading…
Reference in New Issue
Block a user