1148118271 / ssh-rs

Rust implementation of ssh2.0 client 👻 rust实现的ssh2.0客户端

Home Page:https://docs.rs/ssh-rs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only captures stdout

Schievel1 opened this issue · comments

Maybe I haven't found the way how to do this internally, but it certainly is a bit puzzling. When a command executed with exec.send_command("ls -al").unwrap(); like in the exec example succeeds, the send_command() will return the Result containing output.
However, if it doesn't succeed on the remote machine, the remote will print the error to stderr. For most commands at least. Then the returned value from send_command() will still be Ok() but without any contained data.

I mitigated this with 2>&1 after every command to redirect stderr it to stdout on the remote machine. But I wonder if this shouldn't be built in.

Hi @Schievel1 ,

Please use the latest main branch instead of the release package.
Put

[dependencies]
ssh-rs = { git = "https://github.com/1148118271/ssh-rs" }

Or

[dependencies]
ssh-rs = { git = "https://github.com/1148118271/ssh-rs" , rev = "0e85a0455e3d8defe142c146fdeed7d5de745d9b" }

In your Cargo.toml

BRs.

Fixed by #71