Message229602
| Author |
kflavin |
| Recipients |
kflavin |
| Date |
2014年10月17日.20:44:33 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1413578673.84.0.0347750412267.issue22662@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I'm not sure if this is a bash or Python issue. I'm trying to run a command on a remote server, using the subprocess module. I call ssh inside of subprocess.Popen(...).communicate(), like so:
output = subprocess.Popen(["/bin/env %s /usr/bin/ssh -ttt %s@%s -- %s;" % (env, user, host, command)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate()
Following the call to communicate(), my terminal settings are changed. However, it's not always repeatable. Sometimes it happens, and other times it does not. When it does happen, I've noticed that the following tty options are ON prior to the command executing, and OFF afterwards (output from stty -a):
icrnl opost isig icanon echo echoe echok
Something with the communicate() call seems to cause the issue. I don't actually have to print anything to the screen from Python for it to occur.
The problem goes away if I remove the "-t" option to ssh, however, I'm passing through the TERM environmental variable, and need -t to be set. Because of this, I'm not sure if the problem is with the Python call, or something within Bash.
I've been able to repeat this on Ubuntu 13.10 running Python 2.7.5, and on Red Hat 6.4 running Python 2.6.6. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年10月17日 20:44:33 | kflavin | set | recipients:
+ kflavin |
| 2014年10月17日 20:44:33 | kflavin | set | messageid: <1413578673.84.0.0347750412267.issue22662@psf.upfronthosting.co.za> |
| 2014年10月17日 20:44:33 | kflavin | link | issue22662 messages |
| 2014年10月17日 20:44:33 | kflavin | create |
|