diff --git a/IPython/utils/_process_posix.py b/IPython/utils/_process_posix.py index 6afb9fa..ab4b127 100644 --- a/IPython/utils/_process_posix.py +++ b/IPython/utils/_process_posix.py @@ -147,13 +147,17 @@ class ProcessHandler(object): # can set pexpect's search window to be tiny and it won't matter. # We only search for the 'patterns' timeout or EOF, which aren't in # the text itself. - child = pexpect.spawn(self.sh, args=['-c', cmd], encoding=enc) + #child = pexpect.spawn(pcmd, searchwindowsize=1) + try: + child = pexpect.spawn(self.sh, args=['-c', cmd], encoding=enc) # Pexpect-U + except TypeError: + child = pexpect.spawn(self.sh, args=['-c', cmd]) # Vanilla Pexpect flush = sys.stdout.flush while True: # res is the index of the pattern that caused the match, so we # know whether we've finished (if we matched EOF) or not res_idx = child.expect_list(patterns, self.read_timeout) - print(child.before[out_size:], end='') + print(py3compat.cast_unicode(child.before[out_size:], enc), end='') flush() if res_idx==EOF_index: break @@ -169,7 +173,7 @@ class ProcessHandler(object): try: out_size = len(child.before) child.expect_list(patterns, self.terminate_timeout) - print(child.before[out_size:], end='') + print(py3compat.cast_unicode(child.before[out_size:], enc), end='') sys.stdout.flush() except KeyboardInterrupt: # Impatient users tend to type it multiple times