"gnome-terminal -- command" does not work when run in quick succession

I wrote a basic program like this:

while(something) {
    system("gnome-terminal -- another_command");
}

The first terminal opens correctly. Subsequent terminals open too, but they do not run “another_command” like the first one does. To get it to work, I need to wait some arbitrary amount before invoking gnome-terminal again. 1 second works. 1/10 of a second does not. This will not scale.

Why is this? Is this a bug with Fedora? A bug in gnome-terminal? How long must I wait until reinvoking? I wrote a Windows script to do something similar with cmd once, and it did not exhibit the same behavior.

Your example starting GNOME Terminal in loop looks weird as if you are asking for OOM.

Could be. The number of loops depends on a user specified file. If the user wants OOM, so be it.
The point is, 2 gnome-terminals cannot be told to open and run a command within a 1/10 second interval.

It works for me:

> time for I in {1..100}; do gnome-terminal -- touch test.${I}; done

real	0m8.018s
user	0m5.545s
sys	0m1.140s

> rm -v test.* | wc -l
100

Maybe it is the fact that I am using Python’s os.system method

Anyway better change your implementation to something like this:

gnome-terminal -- watch ls -l /
gnome-terminal -- sh -c "ls -l /; sleep 5"
while sleep 1; do ls -l / &> log; done & gnome-terminal -- watch cat log