There was an error while loading. Please reload this page.
1 parent 06cdecb commit 8ba581dCopy full SHA for 8ba581d
1 file changed
openagent/cli.py
@@ -1,5 +1,6 @@
1
import asyncio
2
import os
3
+import sys
4
import click
5
import uvicorn
6
@@ -15,6 +16,21 @@ def shutdown():
15
16
os._exit(0)
17
18
19
+if sys.platform == "win32":
20
+ import threading
21
+ import time
22
+ import msvcrt
23
+
24
+ def check_exit_windows():
25
+ while True:
26
+ if msvcrt.kbhit() and msvcrt.getch().decode("utf-8").lower() == "q":
27
+ shutdown()
28
+ time.sleep(1)
29
30
+ # Start the exit checker thread
31
+ threading.Thread(target=check_exit_windows, daemon=True).start()
32
33
34
@click.group()
35
def cli():
36
"""OpenAgent CLI tool"""
0 commit comments