Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 157

pexpect fails to match command if greater than 65 characters

$
0
0

Issue with pexpect, python module.

Pexpect fails to do expected behavior if the length of the command is greater than 65.

#!/usr/bin/pythonimport pexpectsshCmd='ssh root@15.186.22.105'prompt='[root@user ~]#'ConnectToClient=pexpect.spawn(sshCmd)ConnectToClient.expect('password')ConnectToClient.send('abcd')ConnectToClient.expect(prompt)ConnectToClient.send('echo abcdefghijklmnopqrst111111111111111111111111111111111111111111111111111111111 ')ConnectToClient.expect(prompt) ---> PASScommand = 'echo abcdefghijklmnopqrst111111111111111111111111111111111111111111111111111111111'ConnectToClient.expect(command, prompt) 

While expecting ":", the command (.*) prompt --->FAILS if the length of command is greater than 65.

expect_str = "%s(.*)%s" % (command, self._default_prompt)    

Viewing all articles
Browse latest Browse all 157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>