本文整理汇总了Python中pants.java.nailgun_protocol.NailgunProtocol.send_stderr方法的典型用法代码示例。如果您正苦于以下问题:Python NailgunProtocol.send_stderr方法的具体用法?Python NailgunProtocol.send_stderr怎么用?Python NailgunProtocol.send_stderr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pants.java.nailgun_protocol.NailgunProtocol
的用法示例。
在下文中一共展示了NailgunProtocol.send_stderr方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_send_stderr
# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_stderr [as 别名]
def test_send_stderr(self):
NailgunProtocol.send_stderr(self.server_sock, self.TEST_OUTPUT)
chunk_type, payload = NailgunProtocol.read_chunk(self.client_sock)
self.assertEqual(
(chunk_type, payload),
(ChunkType.STDERR, self.TEST_OUTPUT)
)
示例2: exit
# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_stderr [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()
示例3: exit
# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_stderr [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)
示例4: handle_error
# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_stderr [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)
示例5: handle_error
# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_stderr [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')