Same situation as my other question: Python: Start new command prompt on Windows and wait for it finish/exit except that I need it to work on Linux.
If you don't feel like reading the other question: I want to open some new terminal windows and have each execute a command, and I want the parent python program to wait until all the terminal windows are closed.
Doing:
os.system("gnome-terminal -e {command}")
Opens a new terminal window but the program doesn't wait. Using p = Popen()
and p.wait()
doesn't work because the gnome-terminal command completes instantly.
Gnome-terminal reuses the same parent process for all terminal windows.
Use gnome-terminal --disable-factory
to force it to start a new process.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.