Get the stdout, stderr and status of each shell.send(cmd) ? #18
|
Hi, Is there a way to keep the stdout, stderr and status when a single shell.send() is executed ? Thx. |
Replies: 2 comments 3 replies
|
Unfortunately, this isn't currently possible due to the way we have to read from the channel. Basically, we need to tell it we're done before we can get the information back from it. If you're curious the implementation is here: https://github.com/JacobCallahan/Hussh/blob/master/src/connection.rs#L559 This may be possible in the future when I add in the AsyncConnection class I'm thinking about.. If you, or anyone else, does know of a good way to do this then please do let me know (or raise a PR)! |
|
@jipen I've just added async functionality today that does just this! However I will say that my initial testing showed that the status was always reported as 0 when pulled within an interactive session so not sure if that's something that can be resolved. But if you want to test it yourself feel free to |
Unfortunately, this isn't currently possible due to the way we have to read from the channel. Basically, we need to tell it we're done before we can get the information back from it. If you're curious the implementation is here: https://github.com/JacobCallahan/Hussh/blob/master/src/connection.rs#L559
This may be possible in the future when I add in the AsyncConnection class I'm thinking about..
If you, or anyone else, does know of a good way to do this then please do let me know (or raise a PR)!