Question

How do I pass a certain key combination to a spawned/child process using the pexpect module? I'm using telnet and have to pass Ctrl+Z to a remote server.

Tnx

Was it helpful?

Solution

use sendcontrol()

for example:

p = pexpect.spawn(your_cmd_here)
p.sendcontrol('z')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top