Skip to content

Commit

Permalink
Update main.rs
Browse files Browse the repository at this point in the history
Signed-off-by: ArchBlood <[email protected]>
  • Loading branch information
ArchBlood authored Dec 22, 2024
1 parent f55c17e commit d91428d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ fn establish_ssh_connection(config: &Config) -> io::Result<Session> {
tcp.set_read_timeout(Some(Duration::from_secs(30)))?;
tcp.set_write_timeout(Some(Duration::from_secs(30)))?;

let mut sess = Session::new().ok_or_else(|| {
io::Error::new(io::ErrorKind::Other, "Failed to create SSH session")
let mut sess = Session::new().map_err(|e| {
io::Error::new(io::ErrorKind::Other, format!("Failed to create SSH session: {}", e))
})?;

sess.set_tcp_stream(tcp);
sess.handshake()?;
sess.userauth_password(&config.username, &config.password)?;
Expand Down

0 comments on commit d91428d

Please sign in to comment.