MCPcopy Index your code
hub / github.com/RustPython/RustPython / slave_open

Function slave_open

Lib/pty.py:69–88  ·  view source on GitHub ↗

slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.

(tty_name)

Source from the content-addressed store, hash-verified

67 raise OSError('out of pty devices')
68
69def 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
90def fork():
91 """fork() -> (pid, master_fd)

Callers 1

openptyFunction · 0.85

Calls 3

ioctlFunction · 0.90
warnMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected