I'm using pexpect to connect with ssh to a distance host. when the user or password are incorrect, I get an error but when the dest host is not reachable (for example when I entered an invalid ip or if the host is down) I don't get any indication. any idea why and what I should change in the command in order to get an indication in such case.
The source and dest machines are linux
this is the command I'm running
.../bin/python3 -c 'from pexpect import pxssh;import getpass;s = pxssh.pxssh();s.login("1.1.1.1", "user", "pass", auto_prompt_reset=False);s.sendline("touch /tmp/example.txt");s.prompt();'