*nix interactive_shell module escape character issues fix (with history and arrows)

This commit is contained in:
n1nj4sec 2016-05-25 22:36:58 +02:00
parent 64b55cb91a
commit b4ff342b0a
1 changed files with 5 additions and 1 deletions

View File

@ -82,7 +82,11 @@ class InteractiveShell(PupyModule):
while True: while True:
r, w, x = select.select([sys.stdin], [], [], 0) r, w, x = select.select([sys.stdin], [], [], 0)
if sys.stdin in r: if sys.stdin in r:
input_buf+=sys.stdin.read(1) last_input=sys.stdin.read(1)
if last_input=="\x1b": # in case we read the escape character, we read stdin again because mysteriously, the select won't unlock before getting another character again
last_input+=sys.stdin.read(2)
input_buf+=last_input
elif input_buf: elif input_buf:
self.ps.write(input_buf) self.ps.write(input_buf)
input_buf=b"" input_buf=b""