twisted.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:maas 作者: maas 项目源码 文件源码
def makeDeferredWithProcessProtocol():
    """Returns a (`Deferred`, `ProcessProtocol`) tuple.

    The Deferred's `callback()` will be called (with None) if the
    `ProcessProtocol` is called back indicating that no error occurred.
    Its `errback()` will be called with the `Failure` reason otherwise.
    """
    done = Deferred()
    protocol = ProcessProtocol()
    # Call the errback if the "failure" object indicates a non-zero exit.
    protocol.processEnded = lambda reason: (
        done.errback(reason) if (reason and not reason.check(ProcessDone))
        else done.callback(None))
    return done, protocol
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号