feat: update ssh-rs
This commit is contained in:
4
__shell/sshrs/Cargo.lock
generated
4
__shell/sshrs/Cargo.lock
generated
@@ -508,9 +508,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha2"
|
name = "sha2"
|
||||||
version = "0.10.3"
|
version = "0.10.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "899bf02746a2c92bf1053d9327dadb252b01af1f81f90cdb902411f518bc7215"
|
checksum = "cf9db03534dff993187064c4e0c05a5708d2a9728ace9a8959b77bedf415dac5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cpufeatures",
|
"cpufeatures",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
use ssh_rs::{Session, ssh};
|
use std::thread::sleep;
|
||||||
|
use std::time::Duration;
|
||||||
|
use ssh_rs::{ChannelShell, Session, ssh};
|
||||||
use ssh_rs::key_pair::KeyPairType;
|
use ssh_rs::key_pair::KeyPairType;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@@ -16,4 +18,24 @@ fn main() {
|
|||||||
let exec = session.open_exec().unwrap();
|
let exec = session.open_exec().unwrap();
|
||||||
let v = exec.send_command("ls -l -a --color ~/").unwrap();
|
let v = exec.send_command("ls -l -a --color ~/").unwrap();
|
||||||
println!("{}", String::from_utf8_lossy(&v).to_string());
|
println!("{}", String::from_utf8_lossy(&v).to_string());
|
||||||
}
|
|
||||||
|
println!("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>");
|
||||||
|
let mut shell: ChannelShell = session.open_shell().unwrap();
|
||||||
|
run_shell(&mut shell);
|
||||||
|
|
||||||
|
shell.close().ok();
|
||||||
|
session.close().ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn run_shell(shell: &mut ChannelShell) {
|
||||||
|
sleep(Duration::from_millis(500));
|
||||||
|
let vec = shell.read().unwrap();
|
||||||
|
println!("{}", String::from_utf8(vec).unwrap());
|
||||||
|
|
||||||
|
shell.write(b"ls\n").unwrap();
|
||||||
|
|
||||||
|
sleep(Duration::from_millis(500));
|
||||||
|
|
||||||
|
let vec = shell.read().unwrap();
|
||||||
|
println!("{}", String::from_utf8(vec).unwrap());
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user