mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-26 02:31:36 +03:00
Glances do not exit when eating 'q' #1207
This commit is contained in:
parent
403fd06949
commit
e4d2756c0e
1
NEWS
1
NEWS
@ -30,6 +30,7 @@ Bugs corrected:
|
||||
* KeyError: 'memory_info' on stats sum #1188
|
||||
* Electron/Atom processes displayed wrong in process list #1192
|
||||
* Another encoding issue... With both Python 2 and Python 3 #1197
|
||||
* Glances do not exit when eating 'q' #1207
|
||||
|
||||
Backward-incompatible changes:
|
||||
|
||||
|
@ -77,7 +77,7 @@ def end():
|
||||
# ...after starting the server mode (issue #1175)
|
||||
pass
|
||||
|
||||
logger.info("Glances stopped with CTRL-C")
|
||||
logger.info("Glances stopped (keypressed: CTRL-C)")
|
||||
|
||||
# The end...
|
||||
sys.exit(0)
|
||||
@ -118,6 +118,9 @@ def main():
|
||||
Select the mode (standalone, client or server)
|
||||
Run it...
|
||||
"""
|
||||
# Catch the CTRL-C signal
|
||||
signal.signal(signal.SIGINT, __signal_handler)
|
||||
|
||||
# Log Glances and PSutil version
|
||||
logger.info('Start Glances {}'.format(__version__))
|
||||
logger.info('{} {} and PSutil {} detected'.format(
|
||||
@ -133,8 +136,5 @@ def main():
|
||||
config = core.get_config()
|
||||
args = core.get_args()
|
||||
|
||||
# Catch the CTRL-C signal
|
||||
signal.signal(signal.SIGINT, __signal_handler)
|
||||
|
||||
# Glances can be ran in standalone, client or server mode
|
||||
start(config=config, args=args)
|
||||
|
@ -418,11 +418,11 @@ Examples of use:
|
||||
return self.mode
|
||||
|
||||
def __get_username(self, description=''):
|
||||
"""Read an username from the command line.
|
||||
"""
|
||||
"""Read an username from the command line."""
|
||||
return input(description)
|
||||
|
||||
def __get_password(self, description='', confirm=False, clear=False, username='glances'):
|
||||
def __get_password(self, description='',
|
||||
confirm=False, clear=False, username='glances'):
|
||||
"""Read a password from the command line.
|
||||
|
||||
- if confirm = True, with confirmation
|
||||
|
@ -341,9 +341,7 @@ class _GlancesCurses(object):
|
||||
if return_to_browser:
|
||||
logger.info("Stop Glances client and return to the browser")
|
||||
else:
|
||||
self.end()
|
||||
logger.info("Stop Glances")
|
||||
sys.exit(0)
|
||||
logger.info("Stop Glances (keypressed: {})".format(self.pressedkey))
|
||||
elif self.pressedkey == ord('\n'):
|
||||
# 'ENTER' > Edit the process filter
|
||||
self.edit_filter = not self.edit_filter
|
||||
|
@ -100,7 +100,10 @@ class GlancesStandalone(object):
|
||||
', '.join(sorted(self.stats.getExportsList(enable=False)))))
|
||||
|
||||
def __serve_forever(self):
|
||||
"""Main loop for the CLI."""
|
||||
"""Main loop for the CLI.
|
||||
|
||||
return True if we should continue (no exit key has been pressed)
|
||||
"""
|
||||
# Start a counter used to compute the time needed for
|
||||
# update and export the stats
|
||||
counter = Counter()
|
||||
@ -117,13 +120,23 @@ class GlancesStandalone(object):
|
||||
# Display stats
|
||||
# and wait refresh_time - counter
|
||||
if not self.quiet:
|
||||
self.screen.update(self.stats,
|
||||
duration=self.refresh_time - counter.get())
|
||||
# The update function return True if an exit key 'q' or 'ESC'
|
||||
# has been pressed.
|
||||
ret = not self.screen.update(self.stats,
|
||||
duration=self.refresh_time - counter.get())
|
||||
else:
|
||||
# Nothing is displayed
|
||||
# Break should be done via a signal (CTRL-C)
|
||||
ret = True
|
||||
|
||||
return ret
|
||||
|
||||
def serve_forever(self):
|
||||
"""Wrapper to the serve_forever function."""
|
||||
while True:
|
||||
self.__serve_forever()
|
||||
loop = True
|
||||
while loop:
|
||||
loop = self.__serve_forever()
|
||||
self.end()
|
||||
|
||||
def end(self):
|
||||
"""End of the standalone CLI."""
|
||||
|
Loading…
Reference in New Issue
Block a user