From 29cd72b7d89268e1c98e0040927c167281345eba Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 6 Aug 2015 18:40:15 -0400 Subject: [PATCH] even simpler condition tree for pause --- lib/ansible/plugins/action/pause.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/ansible/plugins/action/pause.py b/lib/ansible/plugins/action/pause.py index 9922a74dba..d012b026c2 100644 --- a/lib/ansible/plugins/action/pause.py +++ b/lib/ansible/plugins/action/pause.py @@ -115,16 +115,13 @@ class ActionModule(ActionBase): while True: try: - if seconds: - key_pressed = self._connection._new_stdin.read(1) - if key_pressed == '\x03': - raise KeyboardInterrupt - else: + key_pressed = self._connection._new_stdin.read(1) + if key_pressed == '\x03': + raise KeyboardInterrupt + + if not seconds: # read key presses and act accordingly - key_pressed = self._connection._new_stdin.read(1) - if key_pressed == '\x03': - raise KeyboardInterrupt - elif key_pressed == '\r': + if key_pressed == '\r': break else: result['user_input'] += key_pressed