mirror of https://github.com/nicolargo/glances.git
Correct a crash in client/server mode
This commit is contained in:
parent
fe48f7df94
commit
3eb67a32bb
|
|
@ -76,7 +76,7 @@ class GlancesClient:
|
|||
def log_and_exit(self, msg=''):
|
||||
"""Log and exit."""
|
||||
if not self.return_to_browser:
|
||||
logger.critical(msg)
|
||||
logger.critical(f"Error when connecting to Glances server: {msg}")
|
||||
sys.exit(2)
|
||||
else:
|
||||
logger.error(msg)
|
||||
|
|
@ -252,6 +252,7 @@ class GlancesClient:
|
|||
return self.client_mode
|
||||
|
||||
exit_key = False
|
||||
|
||||
try:
|
||||
while True and not exit_key:
|
||||
# Update the stats
|
||||
|
|
@ -280,7 +281,7 @@ class GlancesClient:
|
|||
# In quiet mode, we only wait adapated_refresh seconds
|
||||
time.sleep(adapted_refresh)
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
logger.critical(f"Critical error in client serve_forever loop: {e}")
|
||||
self.end()
|
||||
|
||||
return self.client_mode
|
||||
|
|
|
|||
|
|
@ -161,8 +161,8 @@ class _GlancesCurses:
|
|||
# Load configuration file
|
||||
self.load_config(config)
|
||||
|
||||
# Init cursor
|
||||
self._init_cursor()
|
||||
# Init Curses cursor
|
||||
self._init_curses_cursor()
|
||||
|
||||
# Init the colors
|
||||
self.colors_list = GlancesColors(args).get()
|
||||
|
|
@ -183,8 +183,10 @@ class _GlancesCurses:
|
|||
# Init the process min/max reset
|
||||
self.args.reset_minmax_tag = False
|
||||
|
||||
# Init cursor
|
||||
# Init Glances cursor
|
||||
self.args.cursor_position = 0
|
||||
# For the moment cursor only available in standalone mode
|
||||
self.args.disable_cursor = not self.args.is_standalone
|
||||
|
||||
# Catch key pressed with non blocking mode
|
||||
self.term_window.keypad(1)
|
||||
|
|
@ -222,7 +224,7 @@ class _GlancesCurses:
|
|||
|
||||
self.reset_history_tag = False
|
||||
|
||||
def _init_cursor(self):
|
||||
def _init_curses_cursor(self):
|
||||
"""Init cursors."""
|
||||
|
||||
if hasattr(curses, 'noecho'):
|
||||
|
|
@ -1204,10 +1206,17 @@ class _GlancesCurses:
|
|||
class GlancesCursesStandalone(_GlancesCurses):
|
||||
"""Class for the Glances curse standalone."""
|
||||
|
||||
# Default number of processes to displayed is set to 50
|
||||
glances_processes.max_processes = 50
|
||||
|
||||
|
||||
class GlancesCursesClient(_GlancesCurses):
|
||||
"""Class for the Glances curse client."""
|
||||
|
||||
# Default number of processes to displayed is set to 50
|
||||
# For the moment, cursor in client/server mode is not supported see #3221
|
||||
glances_processes.max_processes = 50
|
||||
|
||||
|
||||
class GlancesTextbox(Textbox):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -102,9 +102,6 @@ class GlancesStandalone:
|
|||
# Init screen
|
||||
self.screen = GlancesStdoutCsv(config=config, args=args)
|
||||
else:
|
||||
# Default number of processes to displayed is set to 50
|
||||
glances_processes.max_processes = 50
|
||||
|
||||
# Init screen
|
||||
self.screen = GlancesCursesStandalone(config=config, args=args)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue