Reputation: 85
I want to be able to capture the output of a cli program (before it terminates) for which I don't have the source code.
Everything I have found was either done with pipes, which to my understanding only send the output on a flush or on exit of the program. One solution I have found on Codeproject is only for Windows.
Upvotes: 1
Views: 171
Reputation: 136306
You can use stdbuf
to force stdout
and stderr
of an application to be line-buffered, even when redirected into a pipe or a file:
stdbuf --output=L --error=L <program> | ...
Upvotes: 1