fix double exit logout bug

This commit is contained in:
Diogo Sousa
2023-01-20 17:35:15 +00:00
parent 5802615734
commit 61c6bf94b0
3 changed files with 12 additions and 2 deletions

View File

@@ -60,5 +60,3 @@ def logout():
"""
system_clear()
remove_login_file()
console.print("")
login_controller.login_prompt(welcome=True)

View File

@@ -11,10 +11,13 @@ import os
import re
from abc import ABCMeta, abstractmethod
from datetime import datetime, timedelta
import subprocess
import sys
from typing import Any, Dict, List, Union
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.styles import Style
from rich.markdown import Markdown
@@ -673,6 +676,12 @@ class BaseController(metaclass=ABCMeta):
if ns_parser:
logout()
plt.close("all")
out = subprocess.run( # nosec
f"{sys.executable} terminal.py", shell=True, check=False
)
if out.returncode != 0:
console.print("Unfortunately, resetting wasn't possible!\n")
@log_start_end(log=logger)
def call_whoami(self, other_args: List[str]) -> None:

View File

@@ -901,6 +901,9 @@ def terminal(jobs_cmds: List[str] = None, test_mode=False):
try:
# Process the input command
t_controller.queue = t_controller.switch(an_input)
if an_input == "logout":
break
if an_input in ("q", "quit", "..", "exit", "e"):
print_goodbye()
break