daemon.py: state_msg() fix
This commit is contained in:
parent
46befcb79b
commit
31ad7805ca
1 changed files with 5 additions and 1 deletions
|
|
@ -168,10 +168,14 @@ class Daemon(Lockable):
|
|||
return self.run_cmd(self.cli_cmd(*cmds),silent=silent)
|
||||
|
||||
def state_msg(self,extra_text=None):
|
||||
try:
|
||||
pid = self.pid
|
||||
except:
|
||||
pid = None
|
||||
extra_text = 'not ' if self.state == 'stopped' else f'{extra_text} ' if extra_text else ''
|
||||
return '{:{w}} {:10} {}'.format(
|
||||
f'{self.desc} {extra_text}running',
|
||||
'pid N/A' if self.pid is None or self.pids else f'pid {self.pid}',
|
||||
'pid N/A' if pid is None or self.pids or self.state == 'stopped' else f'pid {pid}',
|
||||
f'port {self.bind_port}',
|
||||
w = 60 )
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue