我正在构建一个 Python 脚本来自动化我的构建过程,它使用 subprocess.Popen 调用 GCC。我最初的尝试效果很好。
>>> import subprocess
>>> p = Popen(['gcc', 'hello.c'], stdout=subprocess.PIPE, stderr=stderr=subprocess.STDOUT)
>>> p.wait()
0
>>> p.communicate()
('', None)
但是,一旦我将其他选项传递给 GCC,我就会收到错误“无输入文件”,如下所示:
>>> import subprocess
>>> p = Popen(['gcc', '-o hello hello.c'], stdout=subprocess.PIPE, stderr=stderr=subprocess.STDOUT)
>>> p.wait()
1
>>> p.communicate()
('gcc: no input files\r\n', None)
任何想法可能导致此问题?