Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在使用Fabric 2运行命令时忽略命令失败_Python_Fabric - Fatal编程技术网

Python 如何在使用Fabric 2运行命令时忽略命令失败

Python 如何在使用Fabric 2运行命令时忽略命令失败,python,fabric,Python,Fabric,在这种情况下: 带有设置的(仅警告=True): 运行可能失败的命令() 目前尚不清楚如何通过上下文管理器在中实现它。建议将warn\u仅替换为run.warn。我想到了: old_warn=c.config.run.warn c、 config.run.warn=True 尝试: 运行可能失败的命令(c) 最后: c、 config.run.warn=old\u warn 也许,有一种更好的方式类似于Fabric的1

在这种情况下:

带有设置的
(仅警告=True):
运行可能失败的命令()
目前尚不清楚如何通过上下文管理器在中实现它。建议将
warn\u仅替换为
run.warn
。我想到了:

old_warn=c.config.run.warn
c、 config.run.warn=True
尝试:
运行可能失败的命令(c)
最后:
c、 config.run.warn=old\u warn
也许,有一种更好的方式类似于Fabric的1