[Gambas-user] Control GUI (Qt5) Gambas program via Standard Input
james at lixce.com
james at lixce.com
Mon Feb 13 13:56:01 CET 2023
BruceS, All,
File.In.Close does allow the program to close which leads me to believe that it is actually opening the Standard Input stream. Unfortunately a terminal application is not going to fulfill the need as it is either a single shot loop or a continuous loop that while I could implement it in a GUI program it is going to severely impact performance and a Pipe or File Watch would be simpler.
The simplest way to write to a process' standard Input and the way I have been testing is from a terminal:
echo "hello" > /proc/$(pgrep -f stdn-in-test)/fd/0
I know it is recieved because it gets echoed to the console in the IDE or the terminal If I run stdn-in-test.gambas in a terminal. BUT IT DOES NOT ACTIVATE ANY EVENT HANDLER
Once (IF) I get this working I can use File.Save("/proc" &/ pid-of-target-app &/ "fd/0", $DATA)
Thanks everyone for your help, I have about a hundred programs I want to implement this in, basically an entire Desktop Userland written in Gambas, but if I cannot make it work then I just need to standardize on one of the other approaches I have used in some of those programs. Probably write to a temp file from the sender and then intercept a SIGUSR2 using gb.Signal in the receiver to read, parse and delete the file. I know it works as that is currently how my Panel App gets updates and the window manager activates the Panel App's menu when the Win-Key is pressed. The Web Browser uses gb.Inotify to watch a file but that may get bogged down if the system is loaded. I have played with named pipes but that really seems to slow everything way down, maybe I was doing it wrong and it seems ungraceful to leave an open pipe sitting there unused 99.99% of the time.
Regards,
J. Jordan
More information about the User
mailing list