I am using subprocess32 3.2.6 with Python 2.6.6 on RHEL 6.5. A sequence like:
command = "sleep 20"
proc = subprocess.Popen(command, shell=True, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
std_out, std_err = proc.communicate(None, timeout=1)
works as expected, ie the one second timeout works. However, if
command = "sleep 20; echo Hello World"
The subprocess seems to run for the entire 20 seconds. I can work around this but it would be nice to either understand what I am doing wrong or why it works the way it does. BTW, this is in a very controlled, trusted environment so the "shell=True" is not risky.