I want to run the following os.system command as a subprocess in order to know its pid since I want to be able to perform a
proc.terminate()
Bellow is the os.system()
Command that works. Note that the bellow command already opens a subshell since thats what the setview
is doing, and then executes a python script inside that subshell and then exits that subshell.
os.system("/usr/atria/bin/cleartool setview -exec '/usr/bin/python /home/testUser/Development/Scripts/setDoneFlag_Count_Lines.py' testUser__project_5_0_myProject_001")
I tried
import subprocess
cmd = "/usr/atria/bin/cleartool setview -exec '/usr/bin/python /home/testUser/Development/Scripts/setDoneFlag_Count_Lines.py' testUser__project_5_0_myProject_001"
p=subprocess.Popen(cmd.split(), shell=True)
Taken from this stackoverflow thread: How to determine pid of process started via os.system
But it only executes the first /usr/atria/bin/cleartool
and not the other commands. Anyone knows how to write a subshell that is equivalent to my os.system call?
Thanks in advance.