fabric 当执行返回码出现非0的命令时, 直接抛出异常退出的。 这种异常不是Exception异常, 而是一个SystemExit异常。 如果需要捕捉异常处理, 只需要
:::python
try:
fab_execute(publish_ccms_pd_root, host=self.host, info=self.info, functions=self.functions)
except SystemExit:
self.write_error()
或者
:::python
try:
run('''ls -al ''')
except SystemExit:
event()
但不建议这样做, 如果你仅仅是碰到错误还是要继续执行, 而不做异常的操作。 可以使用官方的settins.warn_only = True, 这样的话碰到不正常返回码仅仅会抛出Warning 信息。 第一种:环境变量 :::python from fabric.state import env env.warn_only = True 第二种:settings
:::python
from fabric.api import settings
with settings(warn_only=True):
run('ls -al')
(责任编辑:最模板) |

丽人坊化妆品ecshop模板
人气:539
shopex走秀网模板
人气:666
Aspire英文夏季服饰商城m
人气:215
仿2011麦包包ecshop模板
人气:1022
中英俄多语言代购国内商
人气:908
织梦dede机械设备公司企业
人气:3257