Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: tools/yes_no.py

Issue 888873003: tools/sort_sources.py: sort C++ source file names in build files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/sort_sources.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 import sys
6
7
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')
OLDNEW
« no previous file with comments | « tools/sort_sources.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698