MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / spawn

Function spawn

tools/python-3.11.9-amd64/Lib/pty.py:193–217  ·  view source on GitHub ↗

Create a spawned process.

(argv, master_read=_read, stdin_read=_read)

Source from the content-addressed store, hash-verified

191 i_buf += data
192
193def spawn(argv, master_read=_read, stdin_read=_read):
194 """Create a spawned process."""
195 if type(argv) == type(''):
196 argv = (argv,)
197 sys.audit('pty.spawn', argv)
198
199 pid, master_fd = fork()
200 if pid == CHILD:
201 os.execlp(argv[0], *argv)
202
203 try:
204 mode = tcgetattr(STDIN_FILENO)
205 setraw(STDIN_FILENO)
206 restore = True
207 except tty.error: # This is the same as termios.error
208 restore = False
209
210 try:
211 _copy(master_fd, master_read, stdin_read)
212 finally:
213 if restore:
214 tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode)
215
216 close(master_fd)
217 return waitpid(pid, 0)[1]

Callers 1

executeMethod · 0.50

Calls 5

setrawFunction · 0.90
forkFunction · 0.85
_copyFunction · 0.70
closeFunction · 0.70
typeClass · 0.50

Tested by

no test coverage detected