From 4271d94b26b2f1a9e1d1bf0d0ef96ee947b58b1b Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 12 Apr 2022 10:10:31 -0300 Subject: [PATCH] [arch.cpu_manager] improvement: using '/bin/cp' instead of only 'cp' when changing cpu governor (only 'cp' may require confirmation) --- bauh/gems/arch/cpu_manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bauh/gems/arch/cpu_manager.py b/bauh/gems/arch/cpu_manager.py index fc0df7c2..71e7c87b 100644 --- a/bauh/gems/arch/cpu_manager.py +++ b/bauh/gems/arch/cpu_manager.py @@ -1,5 +1,6 @@ import multiprocessing import os +import shutil import traceback from logging import Logger from typing import Optional, Set, Tuple, Dict @@ -42,7 +43,7 @@ def set_governor(governor: str, root_password: Optional[str], cpu_idxs: Optional def _change_governor(cpu_idx: int, new_gov_file_path: str, root_password: Optional[str]): try: gov_file = f'/sys/devices/system/cpu/cpu{cpu_idx}/cpufreq/scaling_governor' - replace = new_root_subprocess(['cp', new_gov_file_path, gov_file], root_password=root_password) + replace = new_root_subprocess((shutil.which('cp'), new_gov_file_path, gov_file), root_password=root_password) replace.wait() except Exception: traceback.print_exc()