Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: tools/telemetry/third_party/subprocess32/testdata/fd_status.py

Issue 1323303002: [Telemetry] Add timeout to telemetry run_tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 """When called as a script, print a comma-separated list of the open
2 file descriptors on stdout."""
3
4 import errno
5 import os
6 import fcntl
7
8 try:
9 _MAXFD = os.sysconf("SC_OPEN_MAX")
10 except:
11 _MAXFD = 256
12
13 def isopen(fd):
14 """Return True if the fd is open, and False otherwise"""
15 try:
16 fcntl.fcntl(fd, fcntl.F_GETFD, 0)
17 except IOError, e:
18 if e.errno == errno.EBADF:
19 return False
20 raise
21 return True
22
23 if __name__ == "__main__":
24 print(','.join(str(fd) for fd in range(0, _MAXFD) if isopen(fd)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698