From: Thomas Lamprecht Date: Wed, 29 Nov 2023 13:51:26 +0000 (+0100) Subject: manager cli: disk wipe: ask over stdout and drop now useless loop X-Git-Tag: v3.1.2~24 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=00b6152cdeadd3c0c97f0e49bacb153eef6b7a0c;p=proxmox-backup.git manager cli: disk wipe: ask over stdout and drop now useless loop Signed-off-by: Thomas Lamprecht --- diff --git a/src/bin/proxmox_backup_manager/disk.rs b/src/bin/proxmox_backup_manager/disk.rs index e0056f6c..9c55a989 100644 --- a/src/bin/proxmox_backup_manager/disk.rs +++ b/src/bin/proxmox_backup_manager/disk.rs @@ -155,21 +155,17 @@ async fn wipe_disk(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result< // If we're on a TTY, query the user if std::io::stdin().is_terminal() { - loop { - eprintln!("You are about to wipe block device {}.", param["disk"]); - eprint!("Are you sure you want to continue? (y/N): "); - let _ = std::io::stdout().flush(); - use std::io::{BufRead, BufReader}; - let mut line = String::new(); - match BufReader::new(std::io::stdin()).read_line(&mut line) { - Ok(_) => { - match line.trim() { - "y" | "Y" => break, - _ => bail!("Aborting."), - } - } - Err(err) => bail!("Failed to read line - {err}."), - } + println!("You are about to wipe block device {}.", param["disk"]); + print!("Are you sure you want to continue? (y/N): "); + let _ = std::io::stdout().flush(); + use std::io::{BufRead, BufReader}; + let mut line = String::new(); + match BufReader::new(std::io::stdin()).read_line(&mut line) { + Ok(_) => match line.trim() { + "y" | "Y" => (), // continue + _ => bail!("Aborting."), + }, + Err(err) => bail!("Failed to read line - {err}."), } }