From 03499c73e2f89dbd973f8d07513431ed7fb0f4b3 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Mon, 1 Feb 2021 10:30:32 +0100 Subject: [PATCH] Update Readme based on #44 --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2ed6588..f65ba22 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,16 @@ To interract with a child process use `spawn` method: ```python import wexpect + +prompt = '[A-Z]\:.+>' + child = wexpect.spawn('cmd.exe') -child.expect('>') -child.sendline('ls') -child.expect('>') -print(child.before) +child.expect(prompt) # Wait for startup prompt + +child.sendline('dir') # List the current directory +child.expect(prompt) + +print(child.before) # Print the list child.sendline('exit') ```