Changeset 432

Show
Ignore:
Timestamp:
05/22/07 23:13:32 (2 years ago)
Author:
athomas
Message:

cly: Fix for console.getch() on non-TTY input.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cly/trunk/cly/console.py

    r425 r432  
    7373 
    7474            fd = sys.stdin.fileno() 
    75             old_settings = termios.tcgetattr(fd) 
    7675            try: 
    77                 tty.setraw(sys.stdin.fileno()) 
    78                 ch = sys.stdin.read(1) 
     76                old_settings = termios.tcgetattr(fd) 
     77            except termios.error: 
     78                return os.read(fd, 1) 
     79            try: 
     80                tty.setraw(fd) 
     81                ch = os.read(fd, 1) 
    7982            finally: 
    8083                termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) 
     
    365368    """Print a list of lists as a table, so that columns line up nicely. 
    366369 
    367  
    368  
    369370    ``header``: list of column headings 
    370371        Will be printed as the first row.