This can happen if e.g. not all required testdata is available, such as
.cd-info - in which case proxmox-low-level-installer will fail early
with

  could not open CD info file '/.cd-info' - No such file or directory at 
Proxmox/Install/ISOEnv.pm line 95.

Currently, next_msg() would just be recursively called until the stack
overflowed in such a case.

Signed-off-by: Christoph Heiss <[email protected]>
---
Changes v1 -> v2:
  * new patch

 proxmox-tui-installer/src/views/install_progress.rs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/proxmox-tui-installer/src/views/install_progress.rs 
b/proxmox-tui-installer/src/views/install_progress.rs
index 303da0e..d001451 100644
--- a/proxmox-tui-installer/src/views/install_progress.rs
+++ b/proxmox-tui-installer/src/views/install_progress.rs
@@ -258,7 +258,12 @@ mod tests {
 
     fn next_msg<R: BufRead>(reader: &mut R) -> Option<LowLevelMessage> {
         let mut line = String::new();
-        reader.read_line(&mut line).expect("a line");
+
+        match reader.read_line(&mut line) {
+            Ok(0) => return None, /* reached EOF */
+            Err(err) => panic!("failed to read message: {err}"),
+            _ => {}
+        }
 
         match serde_json::from_str::<LowLevelMessage>(&line) {
             Ok(msg) => Some(msg),
-- 
2.47.0



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to