doctor: support arm64 phones

pull/6445/head
Delyan Angelov 2020-09-21 21:21:07 +03:00
parent a9ef7d173f
commit 61330c60b5
1 changed files with 11 additions and 2 deletions

View File

@ -24,7 +24,13 @@ fn main(){
arch_details << cmd(command:'sysctl -n machdep.cpu.brand_string') arch_details << cmd(command:'sysctl -n machdep.cpu.brand_string')
} }
if os_kind == 'linux' { if os_kind == 'linux' {
arch_details << cmd(command:'grep "model name" /proc/cpuinfo | sed "s/.*: //gm"') mname := cmd(command:'grep "model name" /proc/cpuinfo | sed "s/.*: //gm"')
if !mname.starts_with('Error:') {
arch_details << mname
} else {
hinfo := cmd(command:'grep "Hardware" /proc/cpuinfo | sed "s/.*: //gm"')
arch_details << hinfo
}
} }
if os_kind == 'windows' { if os_kind == 'windows' {
arch_details << cmd(command:'wmic cpu get name /format:table', line: 1) arch_details << cmd(command:'wmic cpu get name /format:table', line: 1)
@ -83,7 +89,10 @@ fn cmd(c CmdConfig) string {
return 'N/A' return 'N/A'
} }
if x.exit_code == 0 { if x.exit_code == 0 {
return x.output.split_into_lines()[c.line] output := x.output.split_into_lines()
if output.len > 0 && output.len > c.line {
return output[c.line]
}
} }
return 'Error: $x.output' return 'Error: $x.output'
} }