~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to userinteractor.py

  • Committer: Aaron Bentley
  • Date: 2008-11-12 03:00:42 UTC
  • Revision ID: aaron@aaronbentley.com-20081112030042-sqhfrqyf32w4ym09
More shelf test fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import sys
2
 
from bzrlib.osutils import getchar
 
2
 
 
3
if sys.platform == "win32":
 
4
    import msvcrt
 
5
    def getchar():
 
6
        return msvcrt.getch()
 
7
else:
 
8
    import tty
 
9
    import termios
 
10
    def getchar():
 
11
        fd = sys.stdin.fileno()
 
12
        settings = termios.tcgetattr(fd)
 
13
        try:
 
14
            tty.setraw(fd)
 
15
            ch = sys.stdin.read(1)
 
16
        finally:
 
17
            termios.tcsetattr(fd, termios.TCSADRAIN, settings)
 
18
        return ch
3
19
 
4
20
 
5
21
class UserOption: