I've been working on some code that uses subprocess.checkoutput
to execute commands on a remote server through ssh:
subprocess.check_output(['ssh', '-o', 'StrictHostKeyChecking=no',
'-i', 'key.pem', self.pDNS,
'python script.py', html.replace('&', '\&'), '"
{0}"'.format(ua.random)], stderr=subprocess.STDOUT)
This command is run by a number of threads communicating with different servers with little to no shared resources and works fine as far as I've noticed.
However, on top of this code, I've used curses
to write a rudimentary UI for me to monitor what my code is doing. I'm able to input commands using keyboard in a way similar to VIM or EMACS. However, I've noticed that when my code is executing the subprocess line above, keyboard input becomes very unreliable and sporadic, requiring make many repeated key presses for it to register in the program.
Is this because of some issues with subprocess playing nice with the threading
library? If not, does anyone know what might be causing this problem?