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


Python NailgunProtocol.send_start_reading_input方法代码示例

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


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

示例1: test_send_start_reading_input

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

示例2: open

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_start_reading_input [as 别名]
 def open(cls, sock, isatty=False):
   with _pipe(isatty) as (read_fd, write_fd):
     reader = NailgunStreamStdinReader(sock, os.fdopen(write_fd, 'wb'))
     with reader.running():
       # Instruct the thin client to begin reading and sending stdin.
       NailgunProtocol.send_start_reading_input(sock)
       yield read_fd
开发者ID:baroquebobcat,项目名称:pants,代码行数:9,代码来源:nailgun_io.py

示例3: open

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_start_reading_input [as 别名]
 def open(cls, maybe_shutdown_socket, isatty=False):
   # We use a plain pipe here (as opposed to a self-closing pipe), because
   # NailgunStreamStdinReader will close the file descriptor it's writing to when it's done.
   # Therefore, when _self_closing_pipe tries to clean up, it will try to close an already closed fd.
   # The alternative is passing an os.dup(write_fd) to NSSR, but then we have the problem where
   # _self_closing_pipe doens't close the write_fd until the pants run is done, and that generates
   # issues around piping stdin to interactive processes such as REPLs.
   with _pipe(isatty) as (read_fd, write_fd):
     reader = NailgunStreamStdinReader(maybe_shutdown_socket, os.fdopen(write_fd, 'wb'))
     with reader.running():
       # Instruct the thin client to begin reading and sending stdin.
       with maybe_shutdown_socket.lock:
         NailgunProtocol.send_start_reading_input(maybe_shutdown_socket.socket)
       try:
         yield read_fd
       finally:
         os.close(read_fd)
开发者ID:jsirois,项目名称:pants,代码行数:19,代码来源:nailgun_io.py

示例4: handle

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import send_start_reading_input [as 别名]
  def handle(self):
    """Request handler for a single Pailgun request."""
    # Parse the Nailgun request portion.
    _, _, arguments, environment = NailgunProtocol.parse_request(self.request)

    # N.B. the first and second nailgun request arguments (working_dir and command) are currently
    # ignored in favor of a get_buildroot() call within LocalPantsRunner.run() and an assumption
    # that anyone connecting to this nailgun server always intends to run pants itself.

    # Prepend the command to our arguments so it aligns with the expected sys.argv format of python
    # (e.g. [list', '::'] -> ['./pants', 'list', '::']).
    arguments.insert(0, './pants')

    self.logger.info('handling pailgun request: `{}`'.format(' '.join(arguments)))
    self.logger.debug('pailgun request environment: %s', environment)

    # Instruct the client to send stdin (if applicable).
    NailgunProtocol.send_start_reading_input(self.request)

    # Execute the requested command.
    self._run_pants(self.request, arguments, environment)
开发者ID:Gointer,项目名称:pants,代码行数:23,代码来源:pailgun_server.py


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