0

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 !

2
  • Why is gnome-terminal even part of this?
    – NickD
    Commented Aug 31, 2016 at 22:07
  • It just to be able to print some output in this terminal and monitor what happen....
    – Dadep
    Commented Aug 31, 2016 at 22:26

1 Answer 1

1

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.

7
  • Hi thanks for your answer but I do not understand very well, so from where are coming data received in script2.py ? if I just do ./script1 | ./script2.py, it would work ? thanks !
    – Dadep
    Commented Sep 1, 2016 at 3:26
  • Yes, ./script1 | ./script2.py would result in the output of ./script1 being fed into ./script2.py as its input.
    – redneb
    Commented Sep 1, 2016 at 8:52
  • what if i have script.sh then do gnome-terminal ./script.sh and in this script.sh I do @#!/bin/bash { cd /home/therightplace; ./script1 | ./script2.py } || {notify-send "not working"}
    – Dadep
    Commented Sep 1, 2016 at 17:29
  • Yes, that would work. You can also do something like gnome-terminal -x bash -c './script1 | ./script2.py' in order to avoid the auxiliary script. I still don't understand why you need gnome-terminal. You have a terminal where you run the ./script1 | ./script2.py, why not just use that terminal? Is this for some kind of a launcher for your desktop environment?
    – redneb
    Commented Sep 1, 2016 at 19:50
  • exactly I launch it from a .desktop !
    – Dadep
    Commented Sep 1, 2016 at 20:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.