What is the essential difference between spawn and popen methods in python?

spawn refers to the generation process of the pty module and connects its control terminal to the current process standard IO;Popen refers to the generation child process method of the subprocess module. So what"s the difference between the two? From an operating system point of view?

Mar.30,2021

  1. these two are different from the Python level. spawn is just a function, Popen is a class,
  2. spawn is implemented through fork, and then the child process executes specific commands, and then the parent process obtains the output of the terminal, emphasizing the acquisition of data, while subprocess provides the management of more process information, such as the status code to execute the command, child process communication and collection.
  3. spawn is somewhat similar to the operating system's popen system call .

studied the source code and found that spawn reads / writes data by directly binding the three standard IO of the child process to the slave end of the pseudo terminal, and has nothing to do with other data sharing methods such as pipes. I hope it can be of some help to all of you who are in need.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37fd4-2c0c1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37fd4-2c0c1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?