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


Python NailgunProtocol.isatty_to_env方法代码示例

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


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

示例1: test_isatty_to_env_without_tty

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import isatty_to_env [as 别名]
  def test_isatty_to_env_without_tty(self):
    mock_stdin = self._make_mock_stream(False, 0)
    mock_stdout = self._make_mock_stream(False, 1)
    mock_stderr = self._make_mock_stream(False, 2)

    self.assertEqual(
      NailgunProtocol.isatty_to_env(mock_stdin, mock_stdout, mock_stderr),
      {
        'NAILGUN_TTY_0': b'0',
        'NAILGUN_TTY_1': b'0',
        'NAILGUN_TTY_2': b'0',
      })
开发者ID:cosmicexplorer,项目名称:pants,代码行数:14,代码来源:test_nailgun_protocol.py

示例2: run

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import isatty_to_env [as 别名]
  def run(self, args=None):
    # Merge the nailgun TTY capability environment variables with the passed environment dict.
    ng_env = NailgunProtocol.isatty_to_env(self._stdin, self._stdout, self._stderr)
    modified_env = self._combine_dicts(self._env, ng_env)

    # Instantiate a NailgunClient.
    client = NailgunClient(port=self._port, ins=self._stdin, out=self._stdout, err=self._stderr)

    with self._trapped_control_c(client):
      # Execute the command on the pailgun.
      result = client.execute(self.PANTS_COMMAND, *self._args, **modified_env)

    # Exit.
    self._exiter.exit(result)
开发者ID:CaitieM20,项目名称:pants,代码行数:16,代码来源:remote_pants_runner.py

示例3: test_isatty_to_env_with_mock_tty

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import isatty_to_env [as 别名]
  def test_isatty_to_env_with_mock_tty(self, mock_ttyname):
    mock_ttyname.return_value = self._fake_ttyname
    mock_stdin = self._make_mock_stream(True, 0)
    mock_stdout = self._make_mock_stream(True, 1)
    mock_stderr = self._make_mock_stream(True, 2)

    self.assertEqual(
      NailgunProtocol.isatty_to_env(mock_stdin, mock_stdout, mock_stderr),
      {
        'NAILGUN_TTY_0': b'1',
        'NAILGUN_TTY_1': b'1',
        'NAILGUN_TTY_2': b'1',
        'NAILGUN_TTY_PATH_0': self._fake_ttyname,
        'NAILGUN_TTY_PATH_1': self._fake_ttyname,
        'NAILGUN_TTY_PATH_2': self._fake_ttyname,
      })
开发者ID:cosmicexplorer,项目名称:pants,代码行数:18,代码来源:test_nailgun_protocol.py

示例4: _connect_and_execute

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import isatty_to_env [as 别名]
  def _connect_and_execute(self, port):
    # Merge the nailgun TTY capability environment variables with the passed environment dict.
    ng_env = NailgunProtocol.isatty_to_env(self._stdin, self._stdout, self._stderr)
    modified_env = combined_dict(self._env, ng_env)

    assert isinstance(port, int), 'port {} is not an integer!'.format(port)

    # Instantiate a NailgunClient.
    client = NailgunClient(port=port,
                           ins=self._stdin,
                           out=self._stdout,
                           err=self._stderr,
                           exit_on_broken_pipe=True)

    with self._trapped_signals(client), STTYSettings.preserved():
      # Execute the command on the pailgun.
      result = client.execute(self.PANTS_COMMAND, *self._args, **modified_env)

    # Exit.
    self._exiter.exit(result)
开发者ID:benjyw,项目名称:pants,代码行数:22,代码来源:remote_pants_runner.py


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