Closed peter50216 closed 6 years ago
Hey Peter. I don't know nearly enough about the architecture of this module to gauge whether it's wise to ignore all psutil errors. Maybe psutil.ZombieProcess or psutil.NoSuchProcess would be a more fitting exception to catch?
Since the _find_agent function is run at import time, I still think we should ignore all psutil exceptions.
To me, it feels worse that import failed due to status of other process than not finding the right gpg-agent.
Also according to document, there are only three exceptions NoSuchProcess
, AccessDenied
, TimeoutExpired
that are psutil.Error
. (ZombieProcess
is subclass for NoSuchProcess
)
TimeoutExpired
shouldn't be raised here, and I guess we'll want to ignore AccessDenied
too.
Bumping this PR. Is there further work that needs to be done for it to be merged? Thanks.
Yeah we also independently ran into this issue, implemented the same fix, was about to make a PR and then saw this ticket :+1:
Hi @peter50216! Thank you for the patch, and I'm very sorry for the delays in reviewing it and getting it merged.
Merged and in version 3.0.1.
Fix #201. When there's zombie process in system or some process disappears before listing and getting attributes, methods on
proc
would raisepsutil.Error
, and theimport gnupg
statement would fail.