I run a 'mstsc' program in win7 using python's subprocess:
>>> import subprocess
>>> p=subprocess.Popen('mstsc')
>>> p.pid
8884
However, the '8884' process doesn't exist when I check W开发者_如何转开发indows' process moniter, and another 'mstsc' does exist. So I wonder if the 'mstsc' create another subprocess when calling subprocess. Please help?
Well i m still a newbie on python, but still you can go through this.
The Popen class uses CreateProcess function in windows to execute the child program. CreateProcess function Creates a new process and its primary thread. This new process runs in the security context of the calling process.
Internally it use the CreateProcessAsUser or CreateProcessWithLogonW functions to run the new process in the security context of the user.
Which as per my understanding would give a different pid to actual executing suprocess.Popen().
精彩评论