prompt: catch EOF errors

This commit is contained in:
Jörg Thalheim
2025-08-26 13:25:35 +02:00
parent 8ea2dd9b72
commit 5bfa0d7a9d

View File

@@ -134,7 +134,7 @@ def _get_secret_input_with_confirmation(
msg = f"Failed to confirm value for {ident} after {max_attempts} attempts."
raise ClanError(msg)
except KeyboardInterrupt as e:
except (KeyboardInterrupt, EOFError) as e:
msg = "User cancelled the input."
raise ClanError(msg) from e
@@ -175,7 +175,7 @@ def _get_regular_input(input_type: PromptType, text: str) -> str:
case _:
msg = f"Unsupported input type: {input_type}"
raise ClanError(msg)
except KeyboardInterrupt as e:
except (KeyboardInterrupt, EOFError) as e:
msg = "User cancelled the input."
raise ClanError(msg) from e