Run a command using pexpect. The pexpect child is returned.
(self, cmd: str, expect_timeout: float = 10.0)
| 1488 | return self.spawn(cmd, expect_timeout=expect_timeout) |
| 1489 | |
| 1490 | def spawn(self, cmd: str, expect_timeout: float = 10.0) -> "pexpect.spawn": |
| 1491 | """Run a command using pexpect. |
| 1492 | |
| 1493 | The pexpect child is returned. |
| 1494 | """ |
| 1495 | pexpect = importorskip("pexpect", "3.0") |
| 1496 | if hasattr(sys, "pypy_version_info") and "64" in platform.machine(): |
| 1497 | skip("pypy-64 bit not supported") |
| 1498 | if not hasattr(pexpect, "spawn"): |
| 1499 | skip("pexpect.spawn not available") |
| 1500 | logfile = self.path.joinpath("spawn.out").open("wb") |
| 1501 | |
| 1502 | child = pexpect.spawn(cmd, logfile=logfile, timeout=expect_timeout) |
| 1503 | self._request.addfinalizer(logfile.close) |
| 1504 | return child |
| 1505 | |
| 1506 | |
| 1507 | class LineComp: |
no test coverage detected