slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.
(tty_name)
| 67 | raise OSError('out of pty devices') |
| 68 | |
| 69 | def slave_open(tty_name): |
| 70 | """slave_open(tty_name) -> slave_fd |
| 71 | Open the pty slave and acquire the controlling terminal, returning |
| 72 | opened filedescriptor. |
| 73 | Deprecated, use openpty() instead.""" |
| 74 | |
| 75 | import warnings |
| 76 | warnings.warn("Use pty.openpty() instead.", DeprecationWarning, stacklevel=2) # Remove API in 3.14 |
| 77 | |
| 78 | result = os.open(tty_name, os.O_RDWR) |
| 79 | try: |
| 80 | from fcntl import ioctl, I_PUSH |
| 81 | except ImportError: |
| 82 | return result |
| 83 | try: |
| 84 | ioctl(result, I_PUSH, "ptem") |
| 85 | ioctl(result, I_PUSH, "ldterm") |
| 86 | except OSError: |
| 87 | pass |
| 88 | return result |
| 89 | |
| 90 | def fork(): |
| 91 | """fork() -> (pid, master_fd) |