首页 > 编程语言 > 详细

python中subprocess.Popen.poll

时间:2016-04-10 21:20:26      阅读:812      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!