mirror of
https://github.com/b-ryan/powerline-shell.git
synced 2026-09-10 07:26:28 -04:00
BUG-1: Dealt with small edge case for the uptime segment
This commit is contained in:
parent
4b19aa47f1
commit
d1c58e79a9
|
|
@ -8,7 +8,8 @@ class Segment(BasicSegment):
|
|||
powerline = self.powerline
|
||||
try:
|
||||
output = decode(subprocess.check_output(['uptime'], stderr=subprocess.STDOUT))
|
||||
raw_uptime = re.search('(?<=up).+(?=,\s+\d+\s+user)', output).group(0)
|
||||
raw_uptime = re.search('(?<=up).+(?=,\s+\d+\s+user)', output)
|
||||
raw_uptime = '' if not raw_uptime else raw_uptime.group(0)
|
||||
day_search = re.search('\d+(?=\s+day)', output)
|
||||
days = '' if not day_search else '%sd ' % day_search.group(0)
|
||||
hour_search = re.search('\d{1,2}(?=\:)', raw_uptime)
|
||||
|
|
|
|||
Loading…
Reference in a new issue