开发者

process started by python's subprocess doesn't exist

开发者 https://www.devze.com 2023-04-06 00:05 出处:网络
I run a \'mstsc\' program in win7 usingpython\'s subprocess: >>> import subprocess >>> p=subprocess.Popen(\'mstsc\')

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().

0

精彩评论

暂无评论...
验证码 换一张
取 消