From 6cb514ec138efbfe6b41f42ef18fb5caa439295d Mon Sep 17 00:00:00 2001 From: opencode Date: Tue, 24 Mar 2026 17:03:48 +0100 Subject: [PATCH] fix: reset terminal e stdout flush per CLI semplice - stty sane resetta il terminale dopo EnhancedCLI fallito - sys.stdin.readline() invece di input() per terminali problematici - stdout flush prima di read per garantire prompt visibile --- langcode.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/langcode.py b/langcode.py index f1eded4..df68cca 100755 --- a/langcode.py +++ b/langcode.py @@ -142,13 +142,23 @@ def cmd_chat(args): print("📝 Uso CLI semplice...") # CLI semplice con input() + # Reset terminal state dopo eventuale EnhancedCLI fallito + import subprocess + try: + subprocess.run(["stty", "sane"], check=False, capture_output=True) + except: + pass + print("\n" + "=" * 60) print(" CLI SEMPLICE - digita /exit per uscire") print("=" * 60 + "\n") while True: try: - user_input = input("❯ ").strip() + sys.stdout.flush() + sys.stdout.write("❯ ") + sys.stdout.flush() + user_input = sys.stdin.readline().strip() if not user_input: continue