Comment 2 for bug 1722564

Revision history for this message
Brian Murray (brian-murray) wrote :

For reasons unknown to me apport-cli only reads one character.

 37 def raw_input_char(self, prompt):
 38 '''raw_input, but read only one character'''
 39
 40 sys.stdout.write(prompt)
 41 sys.stdout.write(' ')
 42 sys.stdout.flush()
 43
 44 file = sys.stdin.fileno()
 45 saved_attributes = termios.tcgetattr(file)
 46 attributes = termios.tcgetattr(file)
 47 attributes[3] = attributes[3] & ~(termios.ICANON)
 48 attributes[6][termios.VMIN] = 1
 49 attributes[6][termios.VTIME] = 0
 50 termios.tcsetattr(file, termios.TCSANOW, attributes)
 51
 52 try:
 53 ch = str(sys.stdin.read(1))
 54 finally:
 55 termios.tcsetattr(file, termios.TCSANOW, saved_attributes)
 56
 57 sys.stdout.write('\n')
 58 return ch