mitogen: Only close stdio file descriptors that were open at process startup
File descriptors 0, 1, and 2 are usually stdin, stdout, stderr; but not always. If a process is started without one of these then the first descriptor allocated by the process opening a file or socket will be allocated an fd <= STDERR_FILENO. This isn't common, but it does occur, e.g. Windows GUI apps started without being connected to a console, controller side plugins run under Ansible 12 (ansible-core 2.19). In such cases the corresponding sys attribute (e.g. sys.stderr) will be None. refs #1258 See also - https://docs.python.org/3/library/sys.html#sys.__stdin__ - https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_12.html#porting-guide-for-v12-0-0a1 - https://github.com/ansible/ansible/pull/82770 - https://github.com/python/typeshed/issues/11778 - https://gist.github.com/moreati/034fef45f73d809d9411a8a63eca34d6pull/1268/head
parent
49fea37879
commit
6cec613daa
Loading…
Reference in New Issue