yay! it got towork i think! thank you all! I am now going to implement the snippet code into my own console application! Greets Wouter
incase new problems, i will be back.
Am I correct in thinking that FProc was an instance of TProcess?
The reason for some of my questions was that I've previously modified and rebuilt AVRDude, so if necessary could attack the problem from that side as well. I think though that I've also seen this staircasing in another context, and could probably investigate how I'd worked round it there as well.
This is indeed a TProcess.
The reason for this code to exist is there is a command line tool called JLinkCommander that can be used to flash a variety of ARM Cortex controllers (so quite similar in purpose to avrdude) and then I have a dozen small GUI Applications (one for each product) that assists in flashing, calibrating and testing the final product. So I have a TComponent that wraps this JLink Tool (and over the years I have written also a bunch of other components that wrap other tools, some software, some hardware) that I can quickly plug into my Application, set a bunch of properties and use it. I tried to make them all independent of LCL, so I am not calling Application.ProcessMessages directly, instead I call a callback that may or may not call ProcessMessages, depending on whether I make a GUI app or just a command line program, for example our automated test robot (once finished) will call a stripped down command line version of my GUI tools to flash and test the boards.
An improvement to the above code (but needlessly overkill for my applications) would be to have a separate thread doing the blocking read from the pipe and sync each line it reads onto the main thread, but since this tool never runs longer than for a few seconds I can put the entire call into a button method and use it blocking. For something longer running I would wrap it in its own thread.
BTW: All our production runs on small Linux PCs, administration is done mostly with Ansible, and every single self made application (every single one of them) is made with Lazarus, with the exception of some minor scripting here and there which is bash or python.