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
In this case, stdout contains no data. The first iteration of the loop we read the first 64 bytes from stderr, then read from stdout. Since stdout is empty, we close it. Next iteration, we read the next 64 bytes from stderr. Since stdout is closed, we skip reading it, but this leaves newData still set to the stderr data, so this gets assigned to stdout as well.
Dumping out stderr gives a much more sensible output:
b'bash: line 1: /QOpenSys/pkgs/bin/xmlservice-cli: A file or directory in the path name does not exist.\n'
The text was updated successfully, but these errors were encountered:
Instead of reading a small amount of data in a blocking way from the
stdout and stderr streams, enable non-blocking I/O and attempt to read
as much data as possible. In addition, make a convenience function to
handle the stream being closed and timeouts so that we don't need to
store a temp variable in the loop. This prevents the situation that lead
to issue #74 where the stderr data is written to the output XML if
stdout is already closed.
Fixes#74
Instead of reading a small amount of data in a blocking way from the
stdout and stderr streams, enable non-blocking I/O and attempt to read
as much data as possible. In addition, make a convenience function to
handle the stream being closed and timeouts so that we don't need to
store a temp variable in the loop. This prevents the situation that lead
to issue #74 where the stderr data is written to the output XML if
stdout is already closed.
Fixes#74
Instead of reading a small amount of data in a blocking way from the
stdout and stderr streams, enable non-blocking I/O and attempt to read
as much data as possible. In addition, make a convenience function to
handle the stream being closed and timeouts so that we don't need to
store a temp variable in the loop. This prevents the situation that lead
to issue #74 where the stderr data is written to the output XML if
stdout is already closed.
Fixes#74
@jkyeung reported this on Ryvver when itoolkit-utils is not installed. Here's the relevant trace:
When I print out xml_out we get from the transport, I get a longer string:
This is because our handling of reading stdout/stderr is not correct here: https://github.com/IBM/python-itoolkit/blob/main/src/itoolkit/transport/ssh.py#L97-L102
In this case, stdout contains no data. The first iteration of the loop we read the first 64 bytes from stderr, then read from stdout. Since stdout is empty, we close it. Next iteration, we read the next 64 bytes from stderr. Since stdout is closed, we skip reading it, but this leaves
newData
still set to the stderr data, so this gets assigned to stdout as well.Dumping out stderr gives a much more sensible output:
The text was updated successfully, but these errors were encountered: