当前位置: 首页>>代码示例>>Python>>正文


Python NailgunProtocol.send_exit_with_code方法代码示例

本文整理汇总了Python中pants.java.nailgun_protocol.NailgunProtocol.send_exit_with_code方法的典型用法代码示例。如果您正苦于以下问题:Python NailgunProtocol.send_exit_with_code方法的具体用法?Python NailgunProtocol.send_exit_with_code怎么用?Python NailgunProtocol.send_exit_with_code使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pants.java.nailgun_protocol.NailgunProtocol的用法示例。


在下文中一共展示了NailgunProtocol.send_exit_with_code方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: exit

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_exit_with_code [as 别名]
  def exit(self, result=0, msg=None, *args, **kwargs):
    """Exit the runtime."""
    if self._finalizer:
      try:
        self._finalizer()
      except Exception as e:
        try:
          NailgunProtocol.send_stderr(
            self._socket,
            '\nUnexpected exception in finalizer: {!r}\n'.format(e)
          )
        except Exception:
          pass

    try:
      # Write a final message to stderr if present.
      if msg:
        NailgunProtocol.send_stderr(self._socket, msg)

      # Send an Exit chunk with the result.
      NailgunProtocol.send_exit_with_code(self._socket, result)

      # Shutdown the connected socket.
      teardown_socket(self._socket)
    finally:
      super(DaemonExiter, self).exit(result=result, *args, **kwargs)
开发者ID:cosmicexplorer,项目名称:pants,代码行数:28,代码来源:daemon_pants_runner.py

示例2: test_send_exit_with_code

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_exit_with_code [as 别名]
 def test_send_exit_with_code(self):
   return_code = 1
   NailgunProtocol.send_exit_with_code(self.server_sock, return_code)
   chunk_type, payload = NailgunProtocol.read_chunk(self.client_sock, return_bytes=True)
   self.assertEqual(
     (chunk_type, payload),
     (ChunkType.EXIT, NailgunProtocol.encode_int(return_code))
   )
开发者ID:cosmicexplorer,项目名称:pants,代码行数:10,代码来源:test_nailgun_protocol.py

示例3: handle_error

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_exit_with_code [as 别名]
 def handle_error(self, exc=None):
   """Error handler for failed calls to handle()."""
   if exc:
     NailgunProtocol.send_stderr(self.request, traceback.format_exc())
   failure_code = 1
   NailgunProtocol.send_exit_with_code(self.request, failure_code)
开发者ID:cosmicexplorer,项目名称:pants,代码行数:8,代码来源:pailgun_server.py


注:本文中的pants.java.nailgun_protocol.NailgunProtocol.send_exit_with_code方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。