Revert "Require blocking IO for ansible CLI. (#77639)"

This reverts commit e2d54d3594.
pull/77609/head
Matt Clay 3 years ago
parent 26fd5a8c3a
commit 6fdec4a6ab

@ -1,3 +0,0 @@
minor_changes:
- ansible - At startup the stdin/stdout/stderr file handles are checked to verify they are using blocking IO.
If not, the process exits with an error reporting which file handle(s) are using non-blocking IO.

@ -7,7 +7,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
# Used for determining if the system is running a new enough python version
@ -18,28 +17,6 @@ if sys.version_info < (3, 8):
'Current version: %s' % ''.join(sys.version.splitlines())
)
def check_blocking_io():
"""Check stdin/stdout/stderr to make sure they are using blocking IO."""
handles = []
for handle in (sys.stdin, sys.stdout, sys.stderr):
# noinspection PyBroadException
try:
fd = handle.fileno()
except Exception:
continue # not a real file handle, such as during the import sanity test
if not os.get_blocking(fd):
handles.append(getattr(handle, 'name', None) or '#%s' % fd)
if handles:
raise SystemExit('ERROR: Ansible requires blocking IO on stdin/stdout/stderr. '
'Non-blocking file handles detected: %s' % ', '.join(_io for _io in handles))
check_blocking_io()
from importlib.metadata import version
from ansible.module_utils.compat.version import LooseVersion
@ -54,6 +31,7 @@ if jinja2_version < LooseVersion('3.0'):
import errno
import getpass
import os
import subprocess
import traceback
from abc import ABC, abstractmethod

Loading…
Cancel
Save