Closed Clio75 closed 4 years ago
I think the Execute VI, and its underlying libssh2 function (libssh2_channel_exec
) is an "execute once and get out" kind of function. In other words, it can only be used once per session/channel. See Execute multiple commands sequentially with libssh2 on StackOverflow, as it is identical to your error but for C instead of LabVIEW. There is unfortunately no answer or resolution, but it provides evidence that the you cannot use the Execute VI twice on the same session/channel.
Discussion on the libssh2 mailing list also indicates the channel must be destroyed/closed before another Execute can be used.
So, I think you have a couple of options: (1) Create/Open and Destroy/Close a channel for each Execute or (2) investigate using the Shell VI, with the Write All VI.
Option 2 actually looks like the appropriate implementation based on the ssh2.c
example, but I have never really used the Shell VI. Here is a totally untested and probably does not work example:
I will investigate to use the shell option. I will let you know the result
@Clio75, FYI, I created a new release (Alpha-2.0) that includes an example for the single command execution and the fixes for the palettes. If you get a working example of the Shell option, I will add it to the Examples and include in the next release.
With the VIP-1-0-0-15 pallet I have tested this: One channel for each CMD: And it executing perfect.
But also this works; One channel for BOTH CMD:
Great! I will create some examples based on these screenshots and include them in the next release. I will probably not include them as usage examples in the README as those are meant to be quick, simple examples of doing one thing. These feel a little more complex, or something to look at after trying one of the usage examples.
I think this means this issue is resolved.
Hi, I tried to send more that one CMD into the Channel I had created.
But It return: Field_RnD_Services_LIBSSH2_Toolkit.lvlib:Check Status.vi
[Bad Use Error]
Do I need to wait or do something between CMD ?