mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 08:15:42 +00:00
Minor fixes
This commit is contained in:
parent
a15eb316bb
commit
85c379bd9e
@ -337,5 +337,6 @@ class Core:
|
|||||||
def stop(self):
|
def stop(self):
|
||||||
self.run = False
|
self.run = False
|
||||||
self.log.info(i18n.stop)
|
self.log.info(i18n.stop)
|
||||||
asyncio.run(self.web_stop())
|
if config.WebAPI["enabled"]:
|
||||||
|
asyncio.run(self.web_stop())
|
||||||
exit(0)
|
exit(0)
|
||||||
|
@ -14,6 +14,7 @@ from prompt_toolkit import PromptSession, print_formatted_text, HTML
|
|||||||
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
|
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
|
||||||
from prompt_toolkit.completion import NestedCompleter
|
from prompt_toolkit.completion import NestedCompleter
|
||||||
from prompt_toolkit.history import FileHistory
|
from prompt_toolkit.history import FileHistory
|
||||||
|
from prompt_toolkit.patch_stdout import patch_stdout
|
||||||
|
|
||||||
from core import get_logger
|
from core import get_logger
|
||||||
|
|
||||||
@ -186,8 +187,12 @@ class Console:
|
|||||||
session = PromptSession(history=FileHistory('./.cmdhistory'))
|
session = PromptSession(history=FileHistory('./.cmdhistory'))
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
cmd_in = await session.prompt_async(self.__prompt_in,
|
with patch_stdout():
|
||||||
completer=self.completer, auto_suggest=AutoSuggestFromHistory())
|
cmd_in = await session.prompt_async(
|
||||||
|
self.__prompt_in,
|
||||||
|
completer=self.completer,
|
||||||
|
auto_suggest=AutoSuggestFromHistory()
|
||||||
|
)
|
||||||
cmd_s = cmd_in.split(" ")
|
cmd_s = cmd_in.split(" ")
|
||||||
cmd = cmd_s[0]
|
cmd = cmd_s[0]
|
||||||
if cmd == "":
|
if cmd == "":
|
||||||
@ -210,13 +215,3 @@ class Console:
|
|||||||
def stop(self, *args, **kwargs):
|
def stop(self, *args, **kwargs):
|
||||||
self.__is_run = False
|
self.__is_run = False
|
||||||
raise KeyboardInterrupt
|
raise KeyboardInterrupt
|
||||||
|
|
||||||
|
|
||||||
# if __name__ == '__main__':
|
|
||||||
# c = Console()
|
|
||||||
# c.logger_hook()
|
|
||||||
# c.builtins_hook()
|
|
||||||
# log = logging.getLogger(name="name")
|
|
||||||
# log.info("Starting console")
|
|
||||||
# print("Starting console")
|
|
||||||
# asyncio.run(c.start())
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user