Skip to content

runShellCommands hangs on reading output #47

Open
@dminuoso

Description

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:

  1. A shell is requested
  2. Some data is written to the channel as the "command"
  3. 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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions