simplify prompt detection
This commit is contained in:
parent
a1523dd5a5
commit
ed82d466cf
|
@ -62,16 +62,9 @@ class TextAdventures(callbacks.Plugin):
|
|||
|
||||
def output(self, output):
|
||||
response = []
|
||||
prompts = ["> >$", ">$", "\*\*\*MORE\*\*\*", "\) \[Hit any key to continue.\]", "\[Press RETURN or ENTER to begin.\]", "\[Hit any key to continue.\]", pexpect.TIMEOUT]
|
||||
output.expect(prompts, timeout=1)
|
||||
response = output.before
|
||||
try:
|
||||
while not output.match.group().decode().endswith(">"):
|
||||
output.sendline()
|
||||
output.expect(prompts, timeout=2)
|
||||
response += output.before
|
||||
except:
|
||||
pass
|
||||
prompts = ["\n>", "\n> >", "\n)", pexpect.TIMEOUT]
|
||||
output.expect_exact(prompts, timeout=1)
|
||||
response = output.before
|
||||
response = response.decode().splitlines()
|
||||
return response
|
||||
|
||||
|
|
Loading…
Reference in New Issue