Search code examples
bashpipebufferreal-time

two piped process slowdown execution after few time


I've two piped process :

gnome-terminal -e ./script1 | ./script2.py

That I use for "real time" process (my script2.py control motors by serial port) ... It work fine but after a short time it slowdown a lot...

Is there any way to "flush" or to skip some data passing from the pipe to keep my "realtime" as short as possible ? (and get my motors reacting as fast as possible to any change coming from my script1)

thanks a lot !


Solution

  • I think you are confused. The above command will start a new instance of gnome-terminal and run ./script1 inside it, and it will also run ./script2.py inside the original terminal. Additionally, the standard input of ./script2.py will be fed all the data collected from the output of the gnome-terminal -e ./script1 command, and not ./script1. So you are giving ./script2.py the wrong data. In fact, gnome-terminal typically does not produce any output (actually, it may print some stuff in its stderr), so your are giving ./script2.py no data.