Clear wallet data when sync is disabled.
[chromium-blink-merge.git] / tools / yes_no.py
blob8682ec8de5eb7a4f4bfdb9cea618e25511f945e3
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 import sys
8 def YesNo(prompt):
9 """Prompts with a yes/no question, returns True if yes."""
10 print prompt,
11 sys.stdout.flush()
12 # http://code.activestate.com/recipes/134892/
13 if sys.platform == 'win32':
14 import msvcrt
15 ch = msvcrt.getch()
16 else:
17 import termios
18 import tty
19 fd = sys.stdin.fileno()
20 old_settings = termios.tcgetattr(fd)
21 ch = 'n'
22 try:
23 tty.setraw(sys.stdin.fileno())
24 ch = sys.stdin.read(1)
25 finally:
26 termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
27 print ch
28 return ch in ('Y', 'y')