mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[arch.cpu_manager] improvement: using '/bin/cp' instead of only 'cp' when changing cpu governor (only 'cp' may require confirmation)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user