码迷,mamicode.com
首页 > 编程语言 > 详细

python中subprocess.Popen.poll

时间:2016-04-10 21:22:50      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:

import subprocess

proc = subprocess.Popen([python, test.py], stdout=subprocess.PIPE)

while 1:
    print proc.poll() 
#while 1:
#     print "hello"

print "hello"

测试代码如上,poll函数返回码:

0 正常结束

1 sleep

-15 kill

None 在运行

 

poll的返回: A None value indicates that the process hasn’t terminated yet.A negative value -N indicates that the child was terminated by signal N (Unix only).  --来自baidu知道

python中subprocess.Popen.poll

标签:

原文地址:http://www.cnblogs.com/nerrissa/p/5375206.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!