Skip to content

Commit 00463b3

Browse files
committed
auto_cpufreq: fix hanging on --daemon, --live, and --monitor
1 parent e540121 commit 00463b3

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

auto_cpufreq/bin/auto_cpufreq.py

+26-17
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,17 @@ def config_info_dialog():
7676
battery_setup()
7777
conf.notifier.start()
7878
while True:
79-
footer()
80-
gov_check()
81-
cpufreqctl()
82-
distro_info()
83-
sysinfo()
84-
set_autofreq()
85-
countdown(2)
79+
try:
80+
footer()
81+
gov_check()
82+
cpufreqctl()
83+
distro_info()
84+
sysinfo()
85+
set_autofreq()
86+
countdown(2)
87+
except KeyboardInterrupt:
88+
break;
89+
conf.notifier.stop()
8690
elif monitor:
8791
config_info_dialog()
8892
root_check()
@@ -97,15 +101,19 @@ def config_info_dialog():
97101
gnome_power_detect()
98102
tlp_service_detect()
99103
while True:
100-
time.sleep(1)
101-
running_daemon_check()
102-
footer()
103-
gov_check()
104-
cpufreqctl()
105-
distro_info()
106-
sysinfo()
107-
mon_autofreq()
108-
countdown(2)
104+
try:
105+
time.sleep(1)
106+
running_daemon_check()
107+
footer()
108+
gov_check()
109+
cpufreqctl()
110+
distro_info()
111+
sysinfo()
112+
mon_autofreq()
113+
countdown(2)
114+
except KeyboardInterrupt:
115+
break
116+
conf.notifier.stop()
109117
elif live:
110118
root_check()
111119
config_info_dialog()
@@ -134,7 +142,8 @@ def config_info_dialog():
134142
except KeyboardInterrupt:
135143
gnome_power_start_live()
136144
print("")
137-
sys.exit()
145+
break
146+
conf.notifier.stop()
138147
elif stats:
139148
not_running_daemon_check()
140149
config_info_dialog()

0 commit comments

Comments
 (0)