Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exit status 1 on Mac OS X, go test fails #31

Closed
kiwih opened this issue Dec 29, 2014 · 6 comments
Closed

exit status 1 on Mac OS X, go test fails #31

kiwih opened this issue Dec 29, 2014 · 6 comments

Comments

@kiwih
Copy link

kiwih commented Dec 29, 2014

When calling CPUPercent on OS X (Darwin) I get an error returned with the message "Exit status 1".
Tracing it through gopsutil reveals that doSysctrl() with argument "kern.cp_time" is throwing an error.
This is because OS X doesn't have "kern.cp_time" in /usr/sbin/sysctl

As a result, go test fails on OS X.

--- FAIL: TestCpu_times (0.00 seconds)
    cpu_test.go:13: error exit status 1
    cpu_test.go:16: could not get CPUs  exit status 1
--- FAIL: TestCPUPercent (0.00 seconds)
    cpu_test.go:64: error exit status 1
    cpu_test.go:68: wrong number of entries from CPUPercent: []
--- FAIL: TestCPUPercentPerCpu (0.00 seconds)
    cpu_test.go:64: error exit status 1
    cpu_test.go:68: wrong number of entries from CPUPercent: []
@shirou
Copy link
Owner

shirou commented Dec 30, 2014

It seems host_processor_info() is required to get CPU information on darwin. I will try to use it. please wait for a while.

@jcooklin
Copy link

+1

@AaronO
Copy link

AaronO commented Jul 1, 2015

👍 Experiencing this error as well

@shirou
Copy link
Owner

shirou commented Jul 24, 2015

Sorry to keep you waiting, I just implement CPUTimes on darwin, by adhoc compiling the tiny c program which can output cpu times. This is very hacky way, but it works, I think.

@shirou
Copy link
Owner

shirou commented Jul 25, 2015

Due to the #57 (thanks for pquerna), it only enabled when ALLLOW_INSECURE_CPU_HELPER set to "yes".
This behavior is temporary. When I find another way, it will be changed completely.

Thank you

@shirou
Copy link
Owner

shirou commented Sep 17, 2015

Since I change to use CGO on darwin, close this issue. If you find something, please re-open. Thank you.

@shirou shirou closed this as completed Sep 17, 2015
jeffweiss pushed a commit to jeffweiss/gopsutil that referenced this issue Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants