Skip to content

Commit 84caa7c

Browse files
author
LittleCoinCoin
committed
fix: replace blocking input() with TTY-aware request_confirmation
Replace direct input() call in Python environment removal with TTY-aware request_confirmation() function to prevent hanging in non-TTY environments during automated testing. Ensures consistent non-TTY handling across all CLI confirmation prompts in the Hatch package manager.
1 parent 799e1fa commit 84caa7c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

hatch/cli_hatch.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,10 +1020,9 @@ def main():
10201020
force = getattr(args, 'force', False)
10211021

10221022
if not force:
1023-
# Ask for confirmation
1023+
# Ask for confirmation using TTY-aware function
10241024
env_name = args.hatch_env or env_manager.get_current_environment()
1025-
response = input(f"Remove Python environment for '{env_name}'? [y/N]: ")
1026-
if response.lower() not in ['y', 'yes']:
1025+
if not request_confirmation(f"Remove Python environment for '{env_name}'?"):
10271026
print("Operation cancelled")
10281027
return 0
10291028

0 commit comments

Comments
 (0)