提交 27728f3e authored 作者: Serhij S's avatar Serhij S

timeout fix

上级 5f8f3fa2
[package] [package]
name = "roboplc-cli" name = "roboplc-cli"
version = "0.1.5" version = "0.1.6"
edition = "2021" edition = "2021"
authors = ["Serhij S. <div@altertech.com>"] authors = ["Serhij S. <div@altertech.com>"]
license = "Apache-2.0" license = "Apache-2.0"
......
...@@ -352,14 +352,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { ...@@ -352,14 +352,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.map(String::from); .map(String::from);
} }
if timeout.is_none() { if timeout.is_none() {
let toml_timeout = value.get("remote").and_then(|v| v.get("timeout"));
if let Some(t) = toml_timeout {
timeout = Some(u64::try_from( timeout = Some(u64::try_from(
value t.as_integer().ok_or("Invalid timeout (must be integer)")?,
.get("remote")
.and_then(|v| v.get("timeout"))
.and_then(toml::Value::as_integer)
.ok_or("Invalid timeout (must be integer)")?,
)?); )?);
} }
}
robo_toml.replace(value); robo_toml.replace(value);
} }
let timeout = timeout.unwrap_or(DEFAULT_TIMEOUT); let timeout = timeout.unwrap_or(DEFAULT_TIMEOUT);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论