From 0b3a4979c43c1eb428da29a8e90df673b28a3983 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Fri, 29 Nov 2019 10:05:04 +0100 Subject: [PATCH] [ADD] reproduce script for #18 --- issues/i18_setecho_error.py | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 issues/i18_setecho_error.py diff --git a/issues/i18_setecho_error.py b/issues/i18_setecho_error.py new file mode 100644 index 0000000..bf8897f --- /dev/null +++ b/issues/i18_setecho_error.py @@ -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()