I start the SSH process as follows:
sshproc = subprocess.Popen([command], shell=True) exit = os.waitpid(sshproc.pid, 0)[1]
This works and opens an interactive terminal. Based on the documentation for subprocess , sshproc uses the sys.stdin script.
Question: how can I print in stderr or a file, what input goes into this child process? I am creating a logging API and am currently losing my ability to record which commands run in this SSH session.
I don't need an answer, just a push in the right direction.
Thanks everyone!
EDIT: It is important that I start the process as shown above so that I have an interactive SSH session with my user. For example. As far as I know, I can not use communicate() .
python subprocess stdin
sholsapp Sep 16 '10 at 17:56 2010-09-16 17:56
source share