Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only captures stdout #67

Closed
Schievel1 opened this issue Jun 15, 2023 · 2 comments
Closed

Only captures stdout #67

Schievel1 opened this issue Jun 15, 2023 · 2 comments

Comments

@Schievel1
Copy link

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.

@HsuJv
Copy link
Collaborator

HsuJv commented Jun 15, 2023

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.

@HsuJv
Copy link
Collaborator

HsuJv commented Sep 16, 2023

Fixed by #71

@HsuJv HsuJv closed this as completed Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants