From a6e818ee5120f7491a8018284e1191f8362d9692 Mon Sep 17 00:00:00 2001 From: LeSnake Date: Wed, 5 Mar 2025 22:13:03 +0100 Subject: [PATCH] move is_terminal check after on_conflict check fixes program not using on_conflict when terminal non-interactive --- crates/rnote-cli/src/export.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/rnote-cli/src/export.rs b/crates/rnote-cli/src/export.rs index 6d3d289d2e..7b639116db 100644 --- a/crates/rnote-cli/src/export.rs +++ b/crates/rnote-cli/src/export.rs @@ -433,12 +433,6 @@ pub(crate) fn file_conflict_prompt_action( if !output_file.exists() { return Ok(None); } - if !io::stdout().is_terminal() { - return Err(anyhow::anyhow!( - "File conflict for file \"{}\" detected and terminal is not interactive. Option \"--on-conflict\" needs to be supplied.", - output_file.display() - )); - } match on_conflict_overwrite { Some(o) => on_conflict = *o, None => { @@ -452,6 +446,12 @@ pub(crate) fn file_conflict_prompt_action( OnConflict::AlwaysSuffix, ]; while matches!(on_conflict, OnConflict::Ask) { + if !io::stdout().is_terminal() { + return Err(anyhow::anyhow!( + "File conflict for file \"{}\" detected and terminal is not interactive. Option \"--on-conflict\" needs to be supplied.", + output_file.display() + )); + } match dialoguer::Select::new() .with_prompt(format!( "File \"{}\" already exists:",