fix pop empty error [build rs fix] [page skip]

This commit is contained in:
shenjack 2023-06-09 14:48:23 +08:00
parent 84e7c9b5df
commit 77afc037a5

View File

@ -44,6 +44,7 @@ class Console(Options):
name = 'python stdin console' name = 'python stdin console'
running: bool = False running: bool = False
caches: List[str] = []
@new_thread('python console', daemon=True, log_thread=True) @new_thread('python console', daemon=True, log_thread=True)
def main(self): def main(self):
@ -59,14 +60,13 @@ class Console(Options):
def start(self): def start(self):
self.running = True self.running = True
self.caches: List[str] = []
self.main() self.main()
def stop(self): def stop(self):
self.running = False self.running = False
def get_command(self) -> str: def get_command(self) -> Optional[str]:
return self.caches.pop(0) return self.caches.pop(0) if self.caches else None
class Game(Options): class Game(Options):