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

Function fork

Lib/pty.py:90–116  ·  view source on GitHub ↗

fork() -> (pid, master_fd) Fork and make the child a session leader with a controlling terminal.

()

Source from the content-addressed store, hash-verified

88 return result
89
90def fork():
91 """fork() -> (pid, master_fd)
92 Fork and make the child a session leader with a controlling terminal."""
93
94 try:
95 pid, fd = os.forkpty()
96 except (AttributeError, OSError):
97 pass
98 else:
99 if pid == CHILD:
100 try:
101 os.setsid()
102 except OSError:
103 # os.forkpty() already set us session leader
104 pass
105 return pid, fd
106
107 master_fd, slave_fd = openpty()
108 pid = os.fork()
109 if pid == CHILD:
110 os.close(master_fd)
111 os.login_tty(slave_fd)
112 else:
113 os.close(slave_fd)
114
115 # Parent and child process.
116 return pid, master_fd
117
118def _read(fd):
119 """Default read function."""

Callers 2

_spawnvefFunction · 0.70
spawnFunction · 0.70

Calls 2

openptyFunction · 0.70
closeMethod · 0.45

Tested by

no test coverage detected