diff options
author | Joe Borg <joe@josephb.org> | 2017-07-25 15:30:02 +0100 |
---|---|---|
committer | Joe Borg <joe@josephb.org> | 2017-07-26 19:20:33 +0100 |
commit | b45c792f95006987d19b8a97c553573327979700 (patch) | |
tree | 0fb5ccb73ac2122dd1b6dd392b36eab0f57df1bb /heatclient/v1 | |
parent | 6462e5183fd45c94d91e168c709959af4e6782ef (diff) | |
download | python-heatclient-b45c792f95006987d19b8a97c553573327979700.tar.gz |
Fixing read before prompt bug
Due to Python buffering sys.stdin and sys.stdout, the read can be shown
before text prompt.
Change-Id: I86d9ec62f7791da276585ce74a48162315effa7b
Signed-off-by: Joe Borg <joe@josephb.org>
Diffstat (limited to 'heatclient/v1')
-rw-r--r-- | heatclient/v1/shell.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index 97484ca..6f6ff08 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -302,9 +302,9 @@ def do_stack_delete(hc, args): try: if not args.yes and sys.stdin.isatty(): - sys.stdout.write( - _("Are you sure you want to delete this stack(s) [y/N]? ")) - prompt_response = sys.stdin.readline().lower() + prompt_response = six.moves.input( + _("Are you sure you want to delete this stack(s) [y/N]? ") + ).lower() if not prompt_response.startswith('y'): logger.info( 'User did not confirm stack delete so taking no action.') |