New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Linux] Process.num_fds() always 1 more than expected #1789
Comments
Process.num_fds()
always 1 more than expected
I think this is because |
Yep, I agree that's the reason (and therefore it happens with os.getpid() only). I don't think there's nothing to fix here. |
I'm not sure I understand what you mean. It happens because
Did you mean to use a double negative in this sentence? I'm not sure what you're trying to say. This is certainly possible to fix. One way to fix it, for example, would be to use def num_fds(self):
fd_dir = "%s/%s/fd" % (self._procfs_path, self.pid)
num_fds = 0
for entry in os.scandir(fd_dir):
if os.readlink(entry.path) != fd_dir:
num_fds += 1
return num_fds |
I mean this problem occurs only with |
Closing as "won't fix". |
Platform
Bug description
The result of
Process.num_fds()
is always 1 more than expected on Debian 10. I haven't tested on other Linux distros. It gives the expected result on macOS.Test script:
Output on Debian 10:
Output on macOS:
The text was updated successfully, but these errors were encountered: