mirror of
https://github.com/python/cpython.git
synced 2025-11-29 22:41:59 +00:00
are now created non-inheritable; add functions os.get/set_inheritable(), os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
22 lines
544 B
Python
22 lines
544 B
Python
"""Similar to fd_status.py, but only checks file descriptors passed on the
|
|
command line."""
|
|
|
|
import errno
|
|
import os
|
|
import sys
|
|
import stat
|
|
|
|
if __name__ == "__main__":
|
|
fds = map(int, sys.argv[1:])
|
|
inherited = []
|
|
for fd in fds:
|
|
try:
|
|
st = os.fstat(fd)
|
|
except OSError as e:
|
|
if e.errno == errno.EBADF:
|
|
continue
|
|
raise
|
|
# Ignore Solaris door files
|
|
if not stat.S_ISDOOR(st.st_mode):
|
|
inherited.append(fd)
|
|
print(','.join(map(str, inherited)))
|