Method expect of pexpect python module breaks when matching a string in old output
问题 I'm trying to work with gdb remotely, using pexpect. This is my current code: child = pexpect.spawn("ssh root@192.168.3.10 \"gdb\"") child.logfile = sys.stdout child.expect("password:") child.sendline("xxxx") child.expect("(gdb)") child.sendline("attach 9813") child.expect("(gdb)") child.sendline("info registers") child.expect("(gdb)") child.sendcontrol('c') And this is a part of my console output: (...) GNU gdb (GDB) 7.4.1-debian (...) For bug reporting instructions, please see: <http://www