diff options
Diffstat (limited to 'vendor/github.com/shirou/gopsutil/host/host_solaris.go')
-rw-r--r-- | vendor/github.com/shirou/gopsutil/host/host_solaris.go | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/vendor/github.com/shirou/gopsutil/host/host_solaris.go b/vendor/github.com/shirou/gopsutil/host/host_solaris.go index 2560c06..bb83bfc 100644 --- a/vendor/github.com/shirou/gopsutil/host/host_solaris.go +++ b/vendor/github.com/shirou/gopsutil/host/host_solaris.go @@ -38,7 +38,7 @@ func InfoWithContext(ctx context.Context) (*InfoStat, error) { return nil, err } - out, err := invoke.Command(uname, "-srv") + out, err := invoke.CommandWithContext(ctx, uname, "-srv") if err != nil { return nil, err } @@ -87,7 +87,7 @@ func InfoWithContext(ctx context.Context) (*InfoStat, error) { // If everything works, use the current zone ID as the HostID if present. zonename, err := exec.LookPath("/usr/bin/zonename") if err == nil { - out, err := invoke.Command(zonename) + out, err := invoke.CommandWithContext(ctx, zonename) if err == nil { sc := bufio.NewScanner(bytes.NewReader(out)) for sc.Scan() { @@ -114,7 +114,7 @@ func InfoWithContext(ctx context.Context) (*InfoStat, error) { if result.HostID == "" { hostID, err := exec.LookPath("/usr/bin/hostid") if err == nil { - out, err := invoke.Command(hostID) + out, err := invoke.CommandWithContext(ctx, hostID) if err == nil { sc := bufio.NewScanner(bytes.NewReader(out)) for sc.Scan() { @@ -156,7 +156,7 @@ func BootTimeWithContext(ctx context.Context) (uint64, error) { return 0, err } - out, err := invoke.Command(kstat, "-p", "unix:0:system_misc:boot_time") + out, err := invoke.CommandWithContext(ctx, kstat, "-p", "unix:0:system_misc:boot_time") if err != nil { return 0, err } @@ -220,7 +220,7 @@ func KernelVersionWithContext(ctx context.Context) (string, error) { return "", err } - out, err := invoke.Command(uname, "-srv") + out, err := invoke.CommandWithContext(ctx, uname, "-srv") if err != nil { return "", err } @@ -231,3 +231,18 @@ func KernelVersionWithContext(ctx context.Context) (string, error) { } return "", fmt.Errorf("could not get kernel version") } + +func PlatformInformation() (platform string, family string, version string, err error) { + return PlatformInformationWithContext(context.Background()) +} + +func PlatformInformationWithContext(ctx context.Context) (platform string, family string, version string, err error) { + /* This is not finished yet at all. Please contribute! */ + + version, err = KernelVersion() + if err != nil { + return "", "", "", err + } + + return "solaris", "solaris", version, nil +} |