From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 2554A1FF173 for ; Mon, 25 Nov 2024 12:29:55 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 51F7511400; Mon, 25 Nov 2024 12:29:42 +0100 (CET) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Mon, 25 Nov 2024 12:27:20 +0100 Message-ID: <20241125112900.988346-7-c.heiss@proxmox.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241125112900.988346-1-c.heiss@proxmox.com> References: <20241125112900.988346-1-c.heiss@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH installer v2 6/6] tui: tests: catch EOF from proxmox-low-level-installer early X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 --- 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(reader: &mut R) -> Option { 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::(&line) { Ok(msg) => Some(msg), -- 2.47.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel