mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 13:21:38 +03:00
ssh: unwrap -> error handling
The port number is guaranteed to be set in the config parser, just like for the host and user, so the unwrap is "OK", but it's less brittle to handle the error consistent with the others here.
This commit is contained in:
parent
f23e43c0c7
commit
2da43e3666
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1841,7 +1841,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr 0.2.16",
|
||||
"bstr 0.2.17",
|
||||
"fnv",
|
||||
"log",
|
||||
"regex",
|
||||
|
@ -125,7 +125,11 @@ impl SessionInner {
|
||||
.get("user")
|
||||
.ok_or_else(|| anyhow!("username not present in config"))?
|
||||
.to_string();
|
||||
let port = self.config.get("port").unwrap().parse::<u16>()?;
|
||||
let port = self
|
||||
.config
|
||||
.get("port")
|
||||
.ok_or_else(|| anyhow!("port is always set in config loader"))?
|
||||
.parse::<u16>()?;
|
||||
let remote_address = format!("{}:{}", hostname, port);
|
||||
|
||||
let tcp: TcpStream = if let Some(proxy_command) =
|
||||
|
Loading…
Reference in New Issue
Block a user