raise error for timeout

This commit is contained in:
Markus Unterwaditzer
2026-02-23 14:54:23 +01:00
committed by Will Greenberg
parent b72712faa2
commit 7b97ffc01d

View File

@@ -42,7 +42,7 @@ pub async fn telnet_send_command_with_output(
writer.write_all(format!("echo RAYHUNTER_'TELNET'_COMMAND_START; {command}; echo RAYHUNTER_'TELNET'_COMMAND_DONE\r\n").as_bytes()).await?;
let mut read_buf = Vec::new();
let _ = timeout(Duration::from_secs(10), async {
timeout(Duration::from_secs(10), async {
loop {
let Ok(byte) = reader.read_u8().await else {
break;
@@ -60,7 +60,8 @@ pub async fn telnet_send_command_with_output(
}
}
})
.await;
.await
.context("command timed out after 10 seconds")?;
let string = String::from_utf8_lossy(&read_buf);
let start = string.rfind("RAYHUNTER_TELNET_COMMAND_START");
let end = string.rfind("RAYHUNTER_TELNET_COMMAND_DONE");