Can some please guide, why command is not timing out. Below is my Python code
python
>>>from subprocess import Popen, PIPE
>>>command="timeout 5 su - user -c \"user admin display_states\""
>>>print command
timeout 5 su - user "user admin display_states"
>>>process=Popen(command, stdout=PIPE, stderr=PIPE, shell=TRUE)
>>>(output,error)=process.communicate()
(Doesn't terminate after 5 seconds)
Execution on cmd prompt:
Linux>timeout 5 su - user -c "user admin display_states"
Session terminated, killing shell... ...killed.
I expect the timeout command to terminate after 5 seconds, which is not happening in my Python code.