wexpect-venv/issues/i09_confused_string.py
2019-11-26 12:54:36 +01:00

35 lines
757 B
Python

import wexpect
import time
print(wexpect.__version__)
def testPath():
# Path of cmd executable:
cmdPath = 'cmd'
cmdPrompt = '>'
referenceOut = None
while True:
# Start the child process
p = wexpect.spawn(cmdPath)
# Wait for prompt
p.expect(cmdPrompt)
# Send a command
p.sendline('ls')
# time.sleep(0.6) <= this sleep solve...
p.expect(cmdPrompt)
print(cmdPath + " >>" + p.before + '<<')
if referenceOut:
if referenceOut != p.before:
p.interact()
time.sleep(5)
raise Exception()
else:
referenceOut = p.before
testPath()