Run a command using pexpect. The pexpect child is returned.
(self, cmd: str, expect_timeout: float = 10.0)
| 1535 | return self.spawn(cmd, expect_timeout=expect_timeout) |
| 1536 | |
| 1537 | def spawn(self, cmd: str, expect_timeout: float = 10.0) -> pexpect.spawn: |
| 1538 | """Run a command using pexpect. |
| 1539 | |
| 1540 | The pexpect child is returned. |
| 1541 | """ |
| 1542 | pexpect = importorskip("pexpect", "3.0") |
| 1543 | if hasattr(sys, "pypy_version_info") and "64" in platform.machine(): |
| 1544 | skip("pypy-64 bit not supported") |
| 1545 | if not hasattr(pexpect, "spawn"): |
| 1546 | skip("pexpect.spawn not available") |
| 1547 | logfile = self.path.joinpath("spawn.out").open("wb") |
| 1548 | |
| 1549 | child = pexpect.spawn(cmd, logfile=logfile, timeout=expect_timeout) |
| 1550 | self._request.addfinalizer(logfile.close) |
| 1551 | return child |
| 1552 | |
| 1553 | |
| 1554 | class LineComp: |
no test coverage detected