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

Getting command exit status #92

Open
larsch opened this issue Dec 19, 2023 · 3 comments
Open

Getting command exit status #92

larsch opened this issue Dec 19, 2023 · 3 comments

Comments

@larsch
Copy link

larsch commented Dec 19, 2023

Would it be possible to retrieve the command exit status and signal status after running a command with ChannelExec<S>::send_command?

exit_status channel request: https://datatracker.ietf.org/doc/html/rfc4254#section-6.10

@HsuJv
Copy link
Collaborator

HsuJv commented Dec 19, 2023

Let me do some research to find out if we can do this.
Maybe update later this week.

BRs.

@HsuJv
Copy link
Collaborator

HsuJv commented Dec 26, 2023

Hi there,
Sorry for the late
Please refer to the latest example files to find how to get the exit status
BRs.

let mut exec = session.open_exec().unwrap();
exec.exec_command("no_command").unwrap();
let vec = exec.get_output().unwrap();
println!("output: {}", String::from_utf8(vec).unwrap());
println!("exit status: {}", exec.exit_status().unwrap());
println!("terminated msg: {}", exec.terminate_msg().unwrap());
let _ = exec.close();

@larsch
Copy link
Author

larsch commented Jan 10, 2024

Thank you very much! This works beautifully.

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