How to properly use pexpect for this case?

90 views Asked by At

With pexpect.spawn , I have a program running in the background that sends back a line for each input line sent.
What would be the appropriate expect expression for getting the whole lines as output? (after waiting until the line is there in the output)

I do not want to use any specific string (like a prompt), other than the newline to synchronize against.

I tried myprogram.expect('\r\n'), but it seems to contain the input along with the output.

1

There are 1 answers

0
SKT On

I tried myprogram.expect('\r\n'), but it seems to contain the input along with the output. Does this mean the "\n" in input is considered?If yes, thereis a way to suppress the echo by setting set echo to false. You can try that. Also can you paste the code that you are trying?