mirror of
https://github.com/clearml/wexpect-venv
synced 2025-01-30 18:36:57 +00:00
[ADD] reproduce script for #18
This commit is contained in:
parent
dd759bfc61
commit
0b3a4979c4
47
issues/i18_setecho_error.py
Normal file
47
issues/i18_setecho_error.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import wexpect
|
||||||
|
import time
|
||||||
|
import os
|
||||||
|
|
||||||
|
print(wexpect.__version__)
|
||||||
|
|
||||||
|
def test_setecho():
|
||||||
|
# Path of cmd executable:
|
||||||
|
cmdPath = 'cmd'
|
||||||
|
cmdPrompt = '>'
|
||||||
|
referenceOut = None
|
||||||
|
|
||||||
|
# Start the child process
|
||||||
|
p = wexpect.spawn(cmdPath)
|
||||||
|
p.expect(cmdPrompt)
|
||||||
|
|
||||||
|
p.setecho(0) # SETECHO
|
||||||
|
|
||||||
|
p.interact()
|
||||||
|
for c in 'echo Hello':
|
||||||
|
p.send(c)
|
||||||
|
time.sleep(0.2)
|
||||||
|
p.send(os.linesep)
|
||||||
|
|
||||||
|
time.sleep(2)
|
||||||
|
p.stop_interact()
|
||||||
|
p.sendline('exit')
|
||||||
|
|
||||||
|
|
||||||
|
# Start the child process
|
||||||
|
p = wexpect.spawn(cmdPath)
|
||||||
|
p.expect(cmdPrompt)
|
||||||
|
|
||||||
|
p.setecho(1) # SETECHO
|
||||||
|
|
||||||
|
p.interact()
|
||||||
|
for c in 'echo Hello':
|
||||||
|
p.send(c)
|
||||||
|
time.sleep(0.2)
|
||||||
|
p.send(os.linesep)
|
||||||
|
|
||||||
|
time.sleep(2)
|
||||||
|
p.stop_interact()
|
||||||
|
p.sendline('exit')
|
||||||
|
|
||||||
|
|
||||||
|
test_setecho()
|
Loading…
Reference in New Issue
Block a user