From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id C8E7ABFBD2 for ; Tue, 9 Jan 2024 09:20:42 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9F3B714365 for ; Tue, 9 Jan 2024 09:20:12 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 9 Jan 2024 09:20:12 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id C3D084902F for ; Tue, 9 Jan 2024 09:20:11 +0100 (CET) Date: Tue, 09 Jan 2024 09:20:04 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20231117133720.209918-1-m.sandoval@proxmox.com> In-Reply-To: <20231117133720.209918-1-m.sandoval@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1704788384.lm1yfv74a7.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.064 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pbs-devel] applied: [PATCH offline-mirror] use IsTerminal whenever possible X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2024 08:20:42 -0000 with slight context adaptation On November 17, 2023 2:37 pm, Maximiliano Sandoval R wrote: > Continuation of https://lists.proxmox.com/pipermail/pbs-devel/2023-Novemb= er/007078.html. >=20 > Signed-off-by: Maximiliano Sandoval R > --- > src/bin/proxmox-offline-mirror-helper.rs | 5 +++-- > src/bin/proxmox-offline-mirror.rs | 4 ++-- > 2 files changed, 5 insertions(+), 4 deletions(-) >=20 > diff --git a/src/bin/proxmox-offline-mirror-helper.rs b/src/bin/proxmox-o= ffline-mirror-helper.rs > index e62206c..69563ca 100644 > --- a/src/bin/proxmox-offline-mirror-helper.rs > +++ b/src/bin/proxmox-offline-mirror-helper.rs > @@ -1,3 +1,4 @@ > +use std::io::IsTerminal; > use std::path::PathBuf; > use std::process::Command; > use std::{collections::HashMap, path::Path}; > @@ -7,8 +8,8 @@ use anyhow::{bail, format_err, Error}; > use proxmox_offline_mirror::types::{ProductType, Snapshot}; > use proxmox_subscription::SubscriptionInfo; > use proxmox_sys::command::run_command; > +use proxmox_sys::fs::file_get_contents; > use proxmox_sys::fs::{replace_file, CreateOptions}; > -use proxmox_sys::{fs::file_get_contents, linux::tty}; > use proxmox_time::epoch_to_rfc3339_utc; > use serde_json::Value; > =20 > @@ -63,7 +64,7 @@ fn set_subscription_key( > )] > /// Interactive setup wizard. > async fn setup(_param: Value) -> Result<(), Error> { > - if !tty::stdin_isatty() { > + if !std::io::stdin().is_terminal() { > bail!("Setup wizard can only run interactively."); > } > =20 > diff --git a/src/bin/proxmox-offline-mirror.rs b/src/bin/proxmox-offline-= mirror.rs > index 9d37ea6..6e6a2a5 100644 > --- a/src/bin/proxmox-offline-mirror.rs > +++ b/src/bin/proxmox-offline-mirror.rs > @@ -1,4 +1,5 @@ > use std::fmt::Display; > +use std::io::IsTerminal; > use std::matches; > use std::path::Path; > =20 > @@ -10,7 +11,6 @@ use serde_json::Value; > use proxmox_router::cli::{run_cli_command, CliCommand, CliCommandMap, Cl= iEnvironment}; > use proxmox_schema::api; > use proxmox_section_config::SectionConfigData; > -use proxmox_sys::linux::tty; > =20 > use proxmox_offline_mirror::helpers::tty::{ > read_bool_from_tty, read_selection_from_tty, read_string_from_tty, > @@ -778,7 +778,7 @@ fn action_add_key(config: &SectionConfigData) -> Resu= lt > )] > /// Interactive setup wizard. > async fn setup(config: Option, _param: Value) -> Result<(), Erro= r> { > - if !tty::stdin_isatty() { > + if !std::io::stdin().is_terminal() { > bail!("Setup wizard can only run interactively."); > } > =20 > --=20 > 2.39.2 >=20 >=20 >=20 > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel >=20 >=20 >=20