allow non-zero exit cpupower frequency-info -g (#2523)

* set better governor hierarchy and add cli command to change

* allow non-zero exit `cpupower frequency-info -g`
This commit is contained in:
Aiden McClelland
2023-11-16 14:48:33 -07:00
committed by GitHub
parent e631b145b9
commit fbc94cfbfc

View File

@@ -39,13 +39,12 @@ impl std::borrow::Borrow<str> for Governor {
} }
pub async fn get_available_governors() -> Result<BTreeSet<Governor>, Error> { pub async fn get_available_governors() -> Result<BTreeSet<Governor>, Error> {
let raw = String::from_utf8( let raw = Command::new("cpupower")
Command::new("cpupower") .arg("frequency-info")
.arg("frequency-info") .arg("-g")
.arg("-g") .invoke(ErrorKind::CpuSettings)
.invoke(ErrorKind::CpuSettings) .await
.await?, .map_or_else(|e| Ok(e.source.to_string()), String::from_utf8)?;
)?;
let mut for_cpu: OrdMap<u32, BTreeSet<Governor>> = OrdMap::new(); let mut for_cpu: OrdMap<u32, BTreeSet<Governor>> = OrdMap::new();
let mut current_cpu = None; let mut current_cpu = None;
for line in raw.lines() { for line in raw.lines() {