code: def spawn(argv, master_read=_read, stdin_read=_read):
      """Create a spawned process."""
      if isinstance(argv, str):
          argv = (argv,)
      sys.audit("pty.spawn", argv)
  
      pid, master_fd = fork()
      if pid == CHILD:
          os.execlp(argv[0], *argv)
  
      try:
          mode = tcgetattr(STDIN_FILENO)
          setraw(STDIN_FILENO)
          restore = True
      except tty.error:  # This is the same as termios.error
          restore = False
  
      try:
          _copy(master_fd, master_read, stdin_read)
      finally:
          if restore:
              tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode)
  
      close(master_fd)
      return waitpid(pid, 0)[1]
  
file_path: cpython/Lib/pty.py
imports: from select import select
  import os
  import sys
  import tty
  from os import close, waitpid
  from tty import setraw, tcgetattr, tcsetattr
label_desc: Use image node_id 8 for calling a global function with example usage: spawn(argv, master_read, stdin_read) and returns: waitpid