Failure of ANSI library when reciving "Erase in Line" ANSI escape code
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pexpect (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
There is a bug in the 12.04 pexpect package that results in the ANSI library throwing an exception when it receives the "Erase in Line" escape code ("ESC[2K"):
Traceback (most recent call last):
File "./pexpect-
screen.
File "/usr/lib/
self.process(c)
File "/usr/lib/
self.
File "/usr/lib/
self.action (self)
File "/usr/lib/
if arg == 0:
NameError: global name 'arg' is not defined
The following test code can be used to test for this failure:
#!/usr/bin/env python
import sys
import ANSI
print "Testing operation of \"DoEraseLine\" in ANSI library: ",
screen = ANSI.ANSI(25,80)
screen.write("This line should be deleted")
#print screen.pretty()
try:
screen.
#print screen.pretty()
except:
print "FAIL"
sys.exit(1)
print "PASS"
sys.exit(0)
This has been fixed in later versions of pexpect, but is broken in the (still supported?) version in precise. The minimal patch required to resolve this issue is:
--- ANSI.py.orig 2015-07-23 10:22:11.561742106 +0100
+++ ANSI.py 2015-07-23 10:22:29.841339490 +0100
@@ -114,6 +114,7 @@
def DoEraseLine (fsm):
+ arg = int(fsm.
screen = fsm.memory[0]
if arg == 0: