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


Python NailgunProtocol.send_exit方法代码示例

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


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

示例1: test_send_exit

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_exit [as 别名]
 def test_send_exit(self):
   NailgunProtocol.send_exit(self.server_sock, self.TEST_OUTPUT)
   chunk_type, payload = NailgunProtocol.read_chunk(self.client_sock)
   self.assertEqual(
     (chunk_type, payload),
     (ChunkType.EXIT, self.TEST_OUTPUT)
   )
开发者ID:Gointer,项目名称:pants,代码行数:9,代码来源:test_nailgun_protocol.py

示例2: exit

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_exit [as 别名]
  def exit(self, result=0, msg=None):
    """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(self._socket, str(result).encode('ascii'))

      # Shutdown the connected socket.
      teardown_socket(self._socket)
    finally:
      # N.B. Assuming a fork()'d child, cause os._exit to be called here to avoid the routine
      # sys.exit behavior (via `pants.util.contextutil.hard_exit_handler()`).
      raise HardSystemExit()
开发者ID:traviscrawford,项目名称:pants,代码行数:30,代码来源:daemon_pants_runner.py

示例3: test_send_exit_default

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_exit [as 别名]
 def test_send_exit_default(self):
   NailgunProtocol.send_exit(self.server_sock)
   chunk_type, payload = NailgunProtocol.read_chunk(self.client_sock)
   self.assertEqual(
     (chunk_type, payload),
     (ChunkType.EXIT, self.EMPTY_PAYLOAD)
   )
开发者ID:Gointer,项目名称:pants,代码行数:9,代码来源:test_nailgun_protocol.py

示例4: handle_error

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


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