diff --git a/glances/__init__.py b/glances/__init__.py index 71aeeb99..6c15035b 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -52,10 +52,10 @@ if psutil_version_info < psutil_min_version: # Trac malloc is only available on Python 3.4 or higher - - -def __signal_handler(signal, frame): - logger.debug(f"Signal {signal} caught") +def __signal_handler(sig, frame): + logger.debug(f"Signal {sig} caught") + # Avoid Glances hang when killing process with muliple CTRL-C See #3264 + signal.signal(signal.SIGINT, signal.SIG_IGN) end() @@ -188,3 +188,12 @@ def main(): # Glances can be ran in standalone, client or server mode start(config=core.get_config(), args=core.get_args()) + start(config=core.get_config(), args=core.get_args()) + start(config=core.get_config(), args=core.get_args()) + start(config=core.get_config(), args=core.get_args()) + start(config=core.get_config(), args=core.get_args()) + start(config=core.get_config(), args=core.get_args()) + start(config=core.get_config(), args=core.get_args()) + start(config=core.get_config(), args=core.get_args()) + start(config=core.get_config(), args=core.get_args()) + start(config=core.get_config(), args=core.get_args()) diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index c07e8f28..d3e0a7cc 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -397,6 +397,10 @@ class _GlancesCurses: logger.info("Stop Glances client and return to the browser") else: logger.info(f"Stop Glances (keypressed: {self.pressedkey})") + # End the curses window + self.end() + # Exit the program + sys.exit(0) def _handle_refresh(self): glances_processes.reset_internal_cache() diff --git a/glances/outputs/glances_curses_browser.py b/glances/outputs/glances_curses_browser.py index 2300447a..7c2aed2b 100644 --- a/glances/outputs/glances_curses_browser.py +++ b/glances/outputs/glances_curses_browser.py @@ -10,6 +10,7 @@ import curses import math +import sys from glances.logger import logger from glances.outputs.glances_curses import _GlancesCurses @@ -49,7 +50,6 @@ class GlancesCursesBrowser(_GlancesCurses): self._page_max = 0 self._page_max_lines = 0 - self.is_end = False self._revesed_sorting = False self._stats_list = None @@ -157,8 +157,7 @@ class GlancesCursesBrowser(_GlancesCurses): # 'ESC'|'q' > Quit self.end() logger.info("Stop Glances client browser") - # sys.exit(0) - self.is_end = True + sys.exit(0) elif self.pressedkey == 10: # 'ENTER' > Run Glances on the selected server self.active_server = self._current_page * self._page_max_lines + self.cursor_position