From 5e38ada7482ac74bffefbbc34cbe20f019348ac9 Mon Sep 17 00:00:00 2001 From: Adnan Hodzic Date: Tue, 2 Feb 2021 20:56:56 +0100 Subject: [PATCH] Fix "Unable to remove via --remove option for Snap package" (Close #161) --- auto_cpufreq/core.py | 2 +- bin/auto-cpufreq | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py index 9c38627..cb5d951 100644 --- a/auto_cpufreq/core.py +++ b/auto_cpufreq/core.py @@ -209,7 +209,7 @@ def deploy_complete_msg(): def remove_complete_msg(): print("\n" + "-" * 25 + " auto-cpufreq daemon removed " + "-" * 25 + "\n") print("auto-cpufreq successfully removed.") - + footer() def deploy_daemon(): print("\n" + "-" * 21 + " Deploying auto-cpufreq as a daemon " + "-" * 22 + "\n") diff --git a/bin/auto-cpufreq b/bin/auto-cpufreq index 7b5d09e..274bfe6 100755 --- a/bin/auto-cpufreq +++ b/bin/auto-cpufreq @@ -121,8 +121,11 @@ def main(monitor, live, daemon, install, log, debug): root_check() run("snapctl set daemon=disabled", shell=True) run("snapctl stop --disable auto-cpufreq", shell=True) - if auto_cpufreq_log_file.exists(): - auto_cpufreq_log_file.unlink() + if auto_cpufreq_log_path.exists(): + if auto_cpufreq_log_file is not None: + auto_cpufreq_log_file.close() + + auto_cpufreq_log_path.unlink() remove_complete_msg() else: root_check()