in internal/platform/statistics.go [54:113]
func sendFuserEvents(
ch chan tooling.FuserEvent,
events *[]tooling.FuserEvent,
c thirdpartyscan.Context,
deviceId string,
) {
linterInfo := c.LinterInfo()
mountInfo := c.MountInfo()
wg.Wait()
close(ch)
if c.NoStatistics() {
println("Statistics disabled, skipping FUS")
return
}
if !cloud.Token.IsAllowedToSendFUS() {
println("You are not allowed to send FUS")
return
}
fatBytes, err := json.Marshal(*events)
if err != nil {
log.Error(fmt.Errorf("failed to marshal events to json: %w", err))
return
}
// create a file in temp dir
fileName := filepath.Join(GetTmpResultsDir(c.ResultsDir()), "fuser.json")
f, err := os.Create(fileName)
if err != nil {
log.Error(fmt.Errorf("failed to create file %s: %w", fileName, err))
return
}
defer func(f *os.File) {
err := f.Close()
if err != nil {
log.Error(fmt.Errorf("error closing resulting FUS file: %w", err))
}
}(f)
_, err = f.Write(fatBytes)
if err != nil {
log.Error(fmt.Errorf("failed to write events to file %s: %w", fileName, err))
return
}
args := []string{
strutil.QuoteForWindows(mountInfo.JavaPath),
"-jar",
strutil.QuoteForWindows(mountInfo.Fuser),
deviceId,
linterInfo.ProductCode,
linterInfo.LinterVersion,
strutil.QuoteForWindows(fileName),
}
if os.Getenv("GO_TESTING") == "true" {
args = append(args, "true")
}
_, _, _, _ = utils.LaunchAndLog(c.LogDir(), "fuser", args...)
}