Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
feat: Prep for windows limit
Browse files Browse the repository at this point in the history
Related to: #25
  • Loading branch information
clburlison committed Jan 14, 2018
1 parent 32643c4 commit c33433b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/node_windows.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
package client

import (
"encoding/json"
"fmt"
"os/exec"
)

// GetNodeInfo empty func to allow CI to complete
func GetNodeInfo() (*NodeInfoObject, error) {
return nil, nil
}

// GetWin32OS exports win32_operatingsystem powershell class
func GetWin32OS() (Win32OS, error) {
cmd := exec.Command("powershell", "gwmi", "Win32_OperatingSystem", "|", "ConvertTo-Json")

// cmd.Stderr = os.Stderr
o, err := cmd.Output()

if err != nil {
return Win32OS{}, fmt.Errorf("exec gwmi Win32_OperatingSystem: %s", err)
}

var j Win32OS

if err := json.Unmarshal(o, &j); err != nil {
return Win32OS{}, fmt.Errorf("failed unmarshalling Win32_OperatingSystem: %s", err)
}

return j, nil
}

// Win32OS structure
type Win32OS struct {
Caption string `json:"Caption"` //os version
TotalVirtualMemorySize int `json:"TotalVirtualMemorySize"`
TotalVisibleMemorySize int `json:"TotalVisibleMemorySize"`
}

0 comments on commit c33433b

Please sign in to comment.