summaryrefslogtreecommitdiff
path: root/heatclient/osc
diff options
context:
space:
mode:
authorJoe Borg <joe@josephb.org>2017-07-25 15:30:02 +0100
committerJoe Borg <joe@josephb.org>2017-07-26 19:20:33 +0100
commitb45c792f95006987d19b8a97c553573327979700 (patch)
tree0fb5ccb73ac2122dd1b6dd392b36eab0f57df1bb /heatclient/osc
parent6462e5183fd45c94d91e168c709959af4e6782ef (diff)
downloadpython-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/osc')
-rw-r--r--heatclient/osc/v1/stack.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/heatclient/osc/v1/stack.py b/heatclient/osc/v1/stack.py
index 4a64221..7206e71 100644
--- a/heatclient/osc/v1/stack.py
+++ b/heatclient/osc/v1/stack.py
@@ -684,9 +684,9 @@ class DeleteStack(command.Command):
try:
if not parsed_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'):
self.log.info('User did not confirm stack delete so '
'taking no action.')