in cli_tools/diagnostics/main_windows.go [63:98]
func (command cmd) run() (outPath string, err error) {
outPath = filepath.Join(tmpFolder, command.outputFileName)
c := exec.Command(command.path)
argString := command.args
if command.cmdProducesFile {
// Replace any output file args with that path in a temp folder
relPath := command.outputFileName
argString = strings.Replace(argString, relPath, outPath, -1)
} else {
// If the command doesn't produce a file, we need to construct
// one from Stdout and Stderr
outFile, err := os.Create(outPath)
if err != nil {
log.Printf("Error creating file %s: %v", outPath, err)
return outPath, err
}
defer func() {
if cErr := outFile.Close(); err != nil {
err = cErr
}
}()
c.Stdout = outFile
c.Stderr = outFile
}
if command.args != "" {
args := strings.Split(argString, " ")
for _, arg := range args {
// Decode the "%20" to space
c.Args = append(c.Args, strings.ReplaceAll(arg, "%20", " "))
}
}
err = c.Run()
return
}