Skip to content

Commit

Permalink
add error redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
woodruffw committed Mar 21, 2015
1 parent 08f0bbe commit 7d3e4f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/plat/darwin/detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void detect_cpu(void)
int len = MAX_STRLEN;
sysctlbyname("machdep.cpu.brand_string", str, &len, NULL, 0);
*/
cpu_file = popen("sysctl -n machdep.cpu.brand_string | "
cpu_file = popen("sysctl -n machdep.cpu.brand_string 2> /dev/null | "
"sed 's/(\\([Tt][Mm]\\))//g;s/(\\([Rr]\\))//g;s/^//g' | "
"tr -d '\\n' | tr -s ' '", "r");
fgets(cpu_str, MAX_STRLEN, cpu_file);
Expand All @@ -188,7 +188,7 @@ void detect_gpu(void)
{
FILE *gpu_file;

gpu_file = popen("system_profiler SPDisplaysDataType | "
gpu_file = popen("system_profiler SPDisplaysDataType 2> /dev/null | "
"awk -F': ' '/^\\ *Chipset Model:/ {print $2}' | "
"tr -d '\\n'", "r");
fgets(gpu_str, MAX_STRLEN, gpu_file);
Expand Down Expand Up @@ -232,7 +232,7 @@ void detect_mem(void)
long long free_mem = 0;
long long used_mem = 0;

mem_file = popen("sysctl -n hw.memsize", "r");
mem_file = popen("sysctl -n hw.memsize 2> /dev/null", "r");
fscanf(mem_file, "%lld", &total_mem);
pclose(mem_file);

Expand Down Expand Up @@ -325,7 +325,7 @@ void detect_res(void)
{
FILE *res_file;

res_file = popen("system_profiler SPDisplaysDataType | "
res_file = popen("system_profiler SPDisplaysDataType 2> /dev/null | "
"awk '/Resolution:/ {print $2\"x\"$4}' | tr -d '\\n'", "r");
fgets(res_str, MAX_STRLEN, res_file);
pclose(res_file);
Expand Down

0 comments on commit 7d3e4f1

Please sign in to comment.