我试图用python执行bash命令。问题是该程序需要在后台运行,所以我尝试用“amp;amp;”执行代码,但子进程模块会终止它。在
我能帮谁?在
def run_command(bashCommand):
process = subprocess.Popen(bashCommand, shell=True)
output, error = process.communicate()
return output
command = 'bettercap -iface wlx485d60575bf2 -eval "set api.rest.username bettercap; set api.rest.password bettercap; set api.rest.address 127.0.0.1; set api.rest.port 8011; net.probe on; api.rest on" &'
run_command(command)
[解决]它只会在你试图得到输出时杀死它。在
^{pr2}$
目前没有回答
相关问题 更多 >
编程相关推荐