Skip to content

Commit b38919f

Browse files
committed
fix uncaught error in checking for snap
1 parent dadfae0 commit b38919f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

auto_cpufreq/power_helper.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,16 @@ def disable_power_profiles_daemon():
256256

257257
# default gnome_power_svc_disable func (balanced)
258258
def gnome_power_svc_disable():
259-
260-
# check if snap package installed
261-
snap_pkg_check = call(['snap', 'list', '|', 'grep', 'auto-cpufreq'],
262-
stdout=subprocess.DEVNULL,
263-
stderr=subprocess.STDOUT)
264-
259+
snap_pkg_check = 0
265260
if systemctl_exists:
266261
# 0 is active
267262
if gnome_power_status != 0:
268263

269264
try:
265+
# check if snap package installed
266+
snap_pkg_check = call(['snap', 'list', '|', 'grep', 'auto-cpufreq'],
267+
stdout=subprocess.DEVNULL,
268+
stderr=subprocess.STDOUT)
270269
# check if snapd is present and if snap package is installed | 0 is success
271270
if snap_pkg_check == 0:
272271
print("GNOME Power Profiles Daemon is already disabled, it can be re-enabled by running:\n"
@@ -280,7 +279,8 @@ def gnome_power_svc_disable():
280279
except:
281280
# snapd not found on the system
282281
print("There was a problem, couldn't determine GNOME Power Profiles Daemon")
283-
282+
snap_pkg_check = 0
283+
284284
if gnome_power_status == 0 and powerprofilesctl_exists:
285285

286286
if snap_pkg_check == 1:

0 commit comments

Comments
 (0)