【发布时间】:2021-12-07 14:24:03
【问题描述】:
我需要使用 Python 子进程运行 DRI_PRIME=1 glxinfo 命令,它也不应该导致 shell 注入风险。
它给出了以下错误:
FileNotFoundError: [Errno 2] No such file or directory: 'DRI_PRIME=1'
代码:
output = subprocess.check_output(["DRI_PRIME=1", "glxinfo"], shell=False).decode()
print(output)
System: Python3, OS: Linux
【问题讨论】:
标签: python python-3.x shell subprocess