From e5dbf63b65866909ba78e4cd068aca75fcb31a02 Mon Sep 17 00:00:00 2001 From: Jan Pazdziora Date: Wed, 8 Nov 2017 11:59:42 +0100 Subject: [PATCH] Fix #31694: running with closed stdin on python 3 (#31695) --- lib/ansible/plugins/action/pause.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/plugins/action/pause.py b/lib/ansible/plugins/action/pause.py index 300be6f18ed..212aaab5a71 100644 --- a/lib/ansible/plugins/action/pause.py +++ b/lib/ansible/plugins/action/pause.py @@ -144,17 +144,17 @@ class ActionModule(ActionBase): # save the attributes on the existing (duped) stdin so # that we can restore them later after we set raw mode - if PY3: - stdin = self._connection._new_stdin.buffer - else: - stdin = self._connection._new_stdin fd = None try: + if PY3: + stdin = self._connection._new_stdin.buffer + else: + stdin = self._connection._new_stdin fd = stdin.fileno() except (ValueError, AttributeError): # ValueError: someone is using a closed file descriptor as stdin # AttributeError: someone is using a null file descriptor as stdin on windoez - pass + stdin = None if fd is not None: if isatty(fd): old_settings = termios.tcgetattr(fd)