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
This commit is contained in:
opencode committed 2026-03-24 17:03:48 +01:00
1 parent 5d9bd48013
commit 6cb514ec13
1 file changed
+11 -1
+11 -1
View File
@@ -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