mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-04 01:07:49 +02:00
cmd/cli: silent WMI query
The log is being printed by the wmi library, which may cause confusion.
This commit is contained in:
committed by
Cuong Manh Le
parent
8360bdc50a
commit
70ab8032a0
@@ -1,7 +1,10 @@
|
|||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/microsoft/wmi/pkg/base/host"
|
"github.com/microsoft/wmi/pkg/base/host"
|
||||||
"github.com/microsoft/wmi/pkg/base/instance"
|
"github.com/microsoft/wmi/pkg/base/instance"
|
||||||
@@ -32,6 +35,8 @@ func validInterfacesMap() map[string]struct{} {
|
|||||||
|
|
||||||
// validInterfaces returns a list of all physical interfaces.
|
// validInterfaces returns a list of all physical interfaces.
|
||||||
func validInterfaces() []string {
|
func validInterfaces() []string {
|
||||||
|
log.SetOutput(io.Discard)
|
||||||
|
defer log.SetOutput(os.Stderr)
|
||||||
whost := host.NewWmiLocalHost()
|
whost := host.NewWmiLocalHost()
|
||||||
q := query.NewWmiQuery("MSFT_NetAdapter")
|
q := query.NewWmiQuery("MSFT_NetAdapter")
|
||||||
instances, err := instance.GetWmiInstancesFromHost(whost, string(constant.StadardCimV2), q)
|
instances, err := instance.GetWmiInstancesFromHost(whost, string(constant.StadardCimV2), q)
|
||||||
|
|||||||
Reference in New Issue
Block a user