Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
pexpect 3.3 runs failed when use multiprocessing #86
I use pexpect (version 3.3) and multiprocessing in python (version 2.6) code like below:
import pexpect, multiprocessing def login(h, u, p): ssh_new_key = ssh_change_key = 'abc' ssh = pexpect.spawn('ssh %s@%s' % (u, h)) index = ssh.expect([ssh_change_key, ssh_new_key, 'password:'], timeout=5) def worker(): login('188.8.131.52', 'abc', 'abc') if __name__ == '__main__': e_process = multiprocessing.Process(target=worker, args=) e_process.start() e_process.join()
but runs failed, with this traceback:
however pexpect 3.3 runs well in a none multiprocessing environment
Ahh, I guess stdin is closed, as seen in https://docs.python.org/2/library/multiprocessing.html#all-platforms under section. I made this change, I'll revert it -- thanks.