From 6608a6b312d85d667fe08780d34d0d49a760b617 2012-03-08 18:12:43 From: MinRK Date: 2012-03-08 18:12:43 Subject: [PATCH] more general fix for #662 Previously, the extra readline output was only stripped from the front, but I have recently seen it (Python 3.2, OSX 10.7) elsewhere, so the replacement is now a general `re.sub`. --- diff --git a/IPython/testing/tools.py b/IPython/testing/tools.py index 6a289cb..dff9130 100644 --- a/IPython/testing/tools.py +++ b/IPython/testing/tools.py @@ -217,16 +217,12 @@ def ipexec(fname, options=None): full_cmd = '%s %s %s' % (ipython_cmd, cmdargs, full_fname) #print >> sys.stderr, 'FULL CMD:', full_cmd # dbg out = getoutputerror(full_cmd) - # `import readline` causes 'ESC[?1034h' to be the first output sometimes, - # so strip that off the front of the first line if it is found + # `import readline` causes 'ESC[?1034h' to be output sometimes, + # so strip that out before doing comparisons if out: - first = out[0] - m = re.match(r'\x1b\[[^h]+h', first) - if m: - # strip initial readline escape - out = list(out) - out[0] = first[len(m.group()):] - out = tuple(out) + out,err = out + out = re.sub(r'\x1b\[[^h]+h', '', out) + out = out,err return out