1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 from __future__ import print_function
11 """Prompts with a yes/no question, returns True if yes."""
12 print(prompt, end=' ')
14 # http://code.activestate.com/recipes/134892/
15 if sys.platform == 'win32':
21 fd = sys.stdin.fileno()
22 old_settings = termios.tcgetattr(fd)
25 tty.setraw(sys.stdin.fileno())
26 ch = sys.stdin.read(1)
28 termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
30 return ch in ('Y', 'y')