You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
runShellCommands did not work for me, it hung on reading the output on the first command.
After reading the connection protocol specs and your implementation I'm almost convinced that the implementation cannot work for the following reasons:
A shell is requested
Some data is written to the channel as the "command"
readAllChannel tries to read in 1KiB chunks until it reads an empty string
3.1. For each chunkreadChannelEx calls into libssh2_channel_read_ex attempting to read 1KiB
3.2 This ends up eventually calling _libssh2_channel_read which returns the number of bytes read
3.3 That function will only return 0 bytes only if the remote sent an EOF or the channel was closed, otherwise it will either read something or produce EAGAIN.
This loop would terminate only if an EOF was sent or the channel was closed.
Am I looking at this wrong?
The text was updated successfully, but these errors were encountered:
I mean this might work if the remote side sends an EOF appropriately, but none of the devices I've tried it against do this. Your library does not look like you blindly committed code, so Im curious how you justify the code. :)
dminuoso
changed the title
runShellCommands
runShellCommands hangs on reading output
Oct 15, 2018
Hello.
I can't tell that runShellCommands function is well-tested. It may be working in some circumstances. I do not actually use it in my other projects; but I use execCommand function from libssh2-conduit package (lives in this repo too), and can say that it is working. If you know how to patch the runShellCommands function, please feel free to make a pull request :)
Hi,
runShellCommands
did not work for me, it hung on reading the output on the first command.After reading the connection protocol specs and your implementation I'm almost convinced that the implementation cannot work for the following reasons:
readAllChannel
tries to read in 1KiB chunks until it reads an empty string3.1. For each chunk
readChannelEx
calls intolibssh2_channel_read_ex
attempting to read 1KiB3.2 This ends up eventually calling
_libssh2_channel_read
which returns the number of bytes read3.3 That function will only return 0 bytes only if the remote sent an EOF or the channel was closed, otherwise it will either read something or produce EAGAIN.
This loop would terminate only if an EOF was sent or the channel was closed.
Am I looking at this wrong?
The text was updated successfully, but these errors were encountered: