C++: Do not show glibc's Backtrace and Memory map on crash

纵饮孤独 提交于 2019-12-06 12:46:54

The following works for me (by making glibc write errors to stderr instead of /dev/tty):

import copy
import os

# ...

with open(os.devnull, "w") as outfile:
    with open(os.devnull, "w") as errfile:
       env = copy.copy(os.environ)
       env["LIBC_FATAL_STDERR_"] = "1"
       p = subprocess.Popen([os.path.join(bug_folder, project)],
                            stdout=outfile, stderr=errfile, env=env)
       p.wait()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!