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

标准输出和错误输出 #61

Open
GZMaike opened this issue Mar 4, 2023 · 2 comments
Open

标准输出和错误输出 #61

GZMaike opened this issue Mar 4, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@GZMaike
Copy link

GZMaike commented Mar 4, 2023

首先感谢有了这么好用的ssh-rs库,对我的工作帮助很大。

在使用中我发现let vec: Vec<u8> = exec.send_command("ls -all").unwrap();只能收到进程的标准输出,但有些情境中我需要错误输出的信息,比如ls命令的路径不存在或无权限等。

是未提供错误输出呢,还是我没有找到具体的接口?

@HsuJv
Copy link
Collaborator

HsuJv commented Mar 4, 2023

确实是遗漏了标准出错的处理。。可以先用 ls /path/not/exist 2>&1 这种方法workaround一下,会安排进计划
BRs.

@HsuJv
Copy link
Collaborator

HsuJv commented Mar 4, 2023

已经提交fix对标准出错进行了读取,但是现在还在尝试增加读取上个命令的返回值的功能来判断命令的执行是否成功,可能不会很快更新版本, 可以通过在Cargo.toml里指定库的 url 来使用最新版的 ssh-rs
BRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants