Import pexpect only when needed.
()
| 12 | import pexpect |
| 13 | |
| 14 | def _lazy_import_pexpect() -> pexpect: |
| 15 | """Import pexpect only when needed.""" |
| 16 | if platform.system() == "Windows": |
| 17 | raise ValueError("Persistent bash processes are not yet supported on Windows.") |
| 18 | try: |
| 19 | import pexpect |
| 20 | |
| 21 | except ImportError: |
| 22 | raise ImportError( |
| 23 | "pexpect required for persistent bash processes." |
| 24 | " To install, run `pip install pexpect`." |
| 25 | ) |
| 26 | return pexpect |
| 27 | |
| 28 | class BashProcess: |
| 29 | """Executes bash commands and returns the output.""" |
no outgoing calls
no test coverage detected