1 回答
TA贡献1856条经验 获得超5个赞
进行了一些挖掘,但这是我发现的内容:
可以看到幕后结构在做什么:
from fabric.api import output
FAB_SHOW_RUNNING = True # Show the command that fabric runs
FAB_SHOW_STDOUT = False # Show the stdout of the command run
FAB_SHOW_STDERR = False # Show the stderr of the command run
FAB_SHOW_DEBUG = True # Increase logging detail for messages
FAB_SHOW_USER = True
FAB_SHOW_STATUS = False # Prevent fabric from using print in some situations (at least in disconnect_all)
FAB_SHOW_WARNINGS = False # Avoid fabric from showing messages about failed commands
output['running'] = FAB_SHOW_RUNNING
output['stdout'] = FAB_SHOW_STDOUT
output['stderr'] = FAB_SHOW_STDERR
output['debug'] = FAB_SHOW_DEBUG
output['user'] = FAB_SHOW_USER
output['status'] = FAB_SHOW_STATUS
output['warnings'] = FAB_SHOW_WARNINGS
事实证明,它不是使用Fabric,/bin/sh而是因为(在这种情况下)我正在运行本地命令,所以罪魁祸首是子流程模块。为了指定要使用的外壳,您需要指定shell=True和executable='/bin/bash'
添加回答
举报