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


Python NailgunProtocol.isatty_from_env方法代码示例

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


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

示例1: test_isatty_from_env_mixed

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import isatty_from_env [as 别名]
 def test_isatty_from_env_mixed(self):
   self.assertEquals(
     NailgunProtocol.isatty_from_env({
       'NAILGUN_TTY_0': '0',
       'NAILGUN_TTY_1': '1'
     }),
     (False, True, False)
   )
开发者ID:Gointer,项目名称:pants,代码行数:10,代码来源:test_nailgun_protocol.py

示例2: _nailgunned_stdio

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import isatty_from_env [as 别名]
  def _nailgunned_stdio(self, sock):
    """Redirects stdio to the connected socket speaking the nailgun protocol."""
    # Determine output tty capabilities from the environment.
    stdin_isatty, stdout_isatty, stderr_isatty = NailgunProtocol.isatty_from_env(self._env)

    if all((stdin_isatty, stdout_isatty, stderr_isatty)):
      with self._tty_stdio() as finalizer:
        yield finalizer
    else:
      with self._pipe_stdio(sock, stdin_isatty, stdout_isatty, stderr_isatty) as finalizer:
        yield finalizer
开发者ID:traviscrawford,项目名称:pants,代码行数:13,代码来源:daemon_pants_runner.py

示例3: _nailgunned_stdio

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import isatty_from_env [as 别名]
  def _nailgunned_stdio(self, sock):
    """Redirects stdio to the connected socket speaking the nailgun protocol."""
    # Determine output tty capabilities from the environment.
    _, stdout_isatty, stderr_isatty = NailgunProtocol.isatty_from_env(self._env)

    # TODO(kwlzn): Implement remote input reading and fix the non-fork()-safe sys.stdin reference
    # in NailgunClient to enable support for interactive goals like `repl` etc.

    # Construct StreamWriters for stdout, stderr.
    streams = (
      NailgunStreamWriter(sock, ChunkType.STDOUT, isatty=stdout_isatty),
      NailgunStreamWriter(sock, ChunkType.STDERR, isatty=stderr_isatty)
    )

    # Launch the stdin StreamReader and redirect stdio.
    with stdio_as(*streams):
      yield
开发者ID:UnrememberMe,项目名称:pants,代码行数:19,代码来源:daemon_pants_runner.py

示例4: nailgunned_stdio

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import isatty_from_env [as 别名]
  def nailgunned_stdio(cls, sock, env, handle_stdin=True):
    """Redirects stdio to the connected socket speaking the nailgun protocol."""
    # Determine output tty capabilities from the environment.
    stdin_isatty, stdout_isatty, stderr_isatty = NailgunProtocol.isatty_from_env(env)
    is_tty_capable = all((stdin_isatty, stdout_isatty, stderr_isatty))

    if is_tty_capable:
      with cls._tty_stdio(env) as finalizer:
        yield finalizer
    else:
      with cls._pipe_stdio(
        sock,
        stdin_isatty,
        stdout_isatty,
        stderr_isatty,
        handle_stdin
      ) as finalizer:
        yield finalizer
开发者ID:cosmicexplorer,项目名称:pants,代码行数:20,代码来源:daemon_pants_runner.py

示例5: _nailgunned_stdio

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import isatty_from_env [as 别名]
  def _nailgunned_stdio(self, sock):
    """Redirects stdio to the connected socket speaking the nailgun protocol."""
    # Determine output tty capabilities from the environment.
    _, stdout_isatty, stderr_isatty = NailgunProtocol.isatty_from_env(self._env)

    # Construct a StreamReader for stdin.
    stdin_reader = NailgunStreamReader(sys.stdin, sock)

    # Construct StreamWriters for stdout, stderr.
    streams = (
      NailgunStreamWriter(sock, ChunkType.STDOUT, isatty=stdout_isatty),
      NailgunStreamWriter(sock, ChunkType.STDERR, isatty=stderr_isatty),
      stdin_reader
    )

    # Launch the stdin StreamReader and redirect stdio.
    with stdin_reader.running(), stdio_as(*streams):
      yield
开发者ID:jduan,项目名称:pants,代码行数:20,代码来源:daemon_pants_runner.py

示例6: test_isatty_from_empty_env

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import isatty_from_env [as 别名]
 def test_isatty_from_empty_env(self):
   self.assertEquals(NailgunProtocol.isatty_from_env({}), (False, False, False))
开发者ID:Gointer,项目名称:pants,代码行数:4,代码来源:test_nailgun_protocol.py


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