1

I am trying to create a Python script that runs multiple executables in their own terminals at once and blocks on their termination.

What I've done so far is create a thread pool, submit to the pool a worker that attempts to run the executable via Popen in the subprocess module and then .wait() on the result before taking some action. This I have working. What I need help with is launching this in a gnome terminal and waiting on the executable to finish. I am on ubuntu, or else I'd use creationflags=CREATE_NEW_CONSOLE in the Popen constructor, but that seems limited to Windows only. Is this even possible? If I wrap my executable in gnome-terminal in the Popen constructor, the wait call is on gnome-terminal not my executable.

ryan2900
  • 11
  • 1

1 Answers1

0

you can try adding your sub processes inside on the subprocess.Popen as Arrays like below

process = subprocess.Popen(['gnome-terminal', '--', executable_path])
MD Nasirul Islam
  • 501
  • 5
  • 17
  • That is true, but I am trying to block on that executable's termination. I need to wait until it's done terminating before doing something. If I do it with that line, I can't get the pid of my executable to wait on it – ryan2900 Aug 07 '23 at 20:08