【发布时间】:2022-08-19 00:29:37
【问题描述】:
我正在尝试编写一个调用 bash 脚本的 python 文件。我有以下代码
Print (\"hello before subprocess call\")
subprocess.call([\'/builds/adummyscript.sh\'], shell=True)
Print (\"hello after subprocess call\")
虚拟脚本只是一个带有以下代码的 bash 脚本
echo \"hello from the inside of the subprocess call\"
我的代码的输出是
hello from the inside of the subprocess call
hello before subprocess call
hello after subprocess call
我的问题是为什么子进程在打印语句之前运行,我该如何解决这个问题?
标签: python python-3.x bash subprocess