mirror of
				https://github.com/xcat2/confluent.git
				synced 2025-10-31 11:22:28 +00:00 
			
		
		
		
	Only conditionally import readline
If stdout is not a tty, do not import readline. import readline by itself can cause terminal control characters to appear in the stdout. Avoid this by only importing if there seems to be a sign it is connected to a terminal.
This commit is contained in:
		| @@ -46,7 +46,6 @@ import math | ||||
| import getpass | ||||
| import optparse | ||||
| import os | ||||
| import readline | ||||
| import select | ||||
| import shlex | ||||
| import socket | ||||
| @@ -601,9 +600,11 @@ except socket.gaierror: | ||||
| # sys.stdout.write('\x1b[H\x1b[J') | ||||
| # sys.stdout.flush() | ||||
|  | ||||
| readline.parse_and_bind("tab: complete") | ||||
| readline.parse_and_bind("set bell-style none") | ||||
| readline.set_completer(completer) | ||||
| if sys.stdout.isatty(): | ||||
| 	import readline | ||||
| 	readline.parse_and_bind("tab: complete") | ||||
| 	readline.parse_and_bind("set bell-style none") | ||||
| 	readline.set_completer(completer) | ||||
| doexit = False | ||||
| inconsole = False | ||||
| pendingcommand = "" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user