Open keinstein opened 6 months ago
The Read All VIs are not very sophisticated. They are reading all of the buffer internal to libssh2, not continuously reading all of the output from the server. Your resolution sounds like how a more full-featured "shell" is supposed to be implemented using the VIs and functions of the underlying libssh2 library. This toolkit is a thin wrapper around the libssh2 library and relatively "low level". The intention is for more feature full abstractions to be created on top of this library, like you have done.
Are you able to share your implementation as I imagine others would be grateful for the example and guidance? Even just a VI snippet would be greatly appreciated.
Is the Read-Execute-Print-Loop with a Raspberry Pi example similar to your implementation/use case? I added "Raspberry Pi" to the name because I was getting a lot of questions about interacting with Raspberry Pis, but the example is applicable to other targets.
The major problem is:
Fortunately libssh2lv changes only the values, but not the semantics of the return code of the underlying function used by the LabVIEW code.
The examples didn't help me in any way: As I already posted, I'm using an mixture of Read VIs. that pass the original uninterpreted return value from libSSH2 to the common Read All both VI.
This problem also affects both the Read All VI as well as the Read All stderr VI as both do not evaluate whether libssh2 returns 0. None of them honours EAGAIN.
Neither Read All nor Read All stderr work reliably. The situation gets even worse when I tried to combine both VIs to read all output of a batch command like:
I solved this problem for my company in the following way:
I also tried to use “Read All” and “Read All stderr” in blocking mode but this doesn't seem to work. Parallel reads seem to confuse libSSH2 (if I'm not mistaken), serial reads seem to destroy the buffers of the other stream, too. So either stderr or stdout can be retrieved, but not both of them.