include graceful exits
This commit is contained in:
parent
cbfeb8e51e
commit
7d547130ea
3 changed files with 47 additions and 42 deletions
|
|
@ -61,13 +61,14 @@ def relaunch_in_terminal():
|
|||
async def main():
|
||||
relaunch_in_terminal()
|
||||
setup_logging()
|
||||
try:
|
||||
await run_disco_reaper()
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
asyncio.run(main())
|
||||
except KeyboardInterrupt:
|
||||
print("\nExiting...")
|
||||
print("\nOperation terminated by user.")
|
||||
sys.exit(0)
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
|
|
@ -148,8 +148,8 @@ def main():
|
|||
relaunch_in_terminal()
|
||||
config = load_config()
|
||||
setup_logging()
|
||||
platform = select_platform(config)
|
||||
try:
|
||||
platform = select_platform(config)
|
||||
asyncio.run(run_cli(target_platform=platform))
|
||||
except KeyboardInterrupt:
|
||||
print("\nOperation terminated by user.")
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ class DiscoReaperCLI:
|
|||
async def run(self):
|
||||
await self.validate_config()
|
||||
|
||||
try:
|
||||
while True:
|
||||
console.print("")
|
||||
console.print(Panel.fit("Disco Reaper - Server Backup Tool", style="bold green"))
|
||||
|
|
@ -130,8 +131,11 @@ class DiscoReaperCLI:
|
|||
elif choice == "4":
|
||||
await self.edit_configuration()
|
||||
elif choice == "Q":
|
||||
await self.engine.close_connections()
|
||||
break
|
||||
except (KeyboardInterrupt, asyncio.CancelledError):
|
||||
console.print("\n[yellow]Operation terminated by user.[/yellow]")
|
||||
finally:
|
||||
await self.engine.close_connections()
|
||||
|
||||
async def backup_server_profile(self):
|
||||
"""Option 1: Backup name, banner, logo, roles, structure, and custom assets."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue