compile on windows

This commit is contained in:
Alex Dadgar 2018-10-04 16:41:40 -07:00 committed by Michael Schurter
parent ad4fac526c
commit 89dafaaea9
2 changed files with 6 additions and 6 deletions

View file

@ -9,10 +9,10 @@ import (
// configure new process group for child process
func (e *UniversalExecutor) setNewProcessGroup() error {
// We need to check that as build flags includes windows for this file
if e.cmd.SysProcAttr == nil {
e.cmd.SysProcAttr = &syscall.SysProcAttr{}
if e.childCmd.SysProcAttr == nil {
e.childCmd.SysProcAttr = &syscall.SysProcAttr{}
}
e.cmd.SysProcAttr.CreationFlags = syscall.CREATE_NEW_PROCESS_GROUP
e.childCmd.SysProcAttr.CreationFlags = syscall.CREATE_NEW_PROCESS_GROUP
return nil
}

View file

@ -14,7 +14,7 @@ func (f *NetworkFingerprint) linkSpeed(device string) int {
outBytes, err := exec.Command(path, command).Output()
if err != nil {
f.logger.Printf("[WARN] fingerprint.network: Error calling %s (%s): %v", path, command, err)
f.logger.Warn("failed to detect link speed", "path", path, "command", command, "error", err)
return 0
}
@ -26,14 +26,14 @@ func (f *NetworkFingerprint) linkSpeed(device string) int {
func (f *NetworkFingerprint) parseLinkSpeed(commandOutput string) int {
args := strings.Split(commandOutput, " ")
if len(args) != 2 {
f.logger.Printf("[WARN] fingerprint.network: Couldn't split LinkSpeed (%s)", commandOutput)
f.logger.Warn("couldn't split LinkSpeed output", "output", commandOutput)
return 0
}
unit := strings.Replace(args[1], "\r\n", "", -1)
value, err := strconv.Atoi(args[0])
if err != nil {
f.logger.Printf("[WARN] fingerprint.network: Unable to parse LinkSpeed value (%s)", commandOutput)
f.logger.Warn("unable to parse LinkSpeed value", "value", commandOutput)
return 0
}