【发布时间】:2018-10-19 18:30:48
【问题描述】:
如何在同一个 shell 中运行源化 bash 脚本,然后更改目录,然后运行命令(使用 python)?这甚至可能吗?
我的尝试:
subprocess.check_call(["env -i bash -c 'source ./init-build ARG'", "cd ../myDir", "bitbake myBoard"], shell =True)
【问题讨论】:
-
将 check_call 更改为 check_output。 check_call 退出而不等待后代进程,而 check output 等待直到读取所有输出。
标签: python bash subprocess