您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

捕获崩溃子进程的“ Segmentation fault”消息:在调用communication()之后没有out和err

捕获崩溃子进程的“ Segmentation fault”消息:在调用communication()之后没有out和err

编辑:回到这里:它与python3的子进程一样具有魅力,如果您在linux上,则有一个名为subprocess32的python2反向移植,可以很好地完成工作

def cmdlineCall(name, args):
child = pexpect.spawn(name, args)
# Wait for the end of the output
child.expect(pexpect.EOF) 
out = child.before # we get all the data before the EOF (stderr and stdout)
child.close() # that will set the return code for us
# signalstatus and existstatus read as the same (for my purpose only)
if child.exitstatus is None:
    returncode = child.signalstatus
else:
    returncode=child.exitstatus
return (out,returncode)

PS:慢一点(因为它会生成伪tty)

其他 2022/1/1 18:28:08 有558人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶