MCPcopy
hub / github.com/mudler/LocalAI / readFileBestEffort

Function readFileBestEffort

pkg/xsysinfo/memory.go:28–34  ·  view source on GitHub ↗

readFileBestEffort reads a file and returns its contents, or "" on any error. Missing cgroup/proc files (e.g. on non-Linux hosts) are expected and benign.

(path string)

Source from the content-addressed store, hash-verified

26// readFileBestEffort reads a file and returns its contents, or "" on any error.
27// Missing cgroup/proc files (e.g. on non-Linux hosts) are expected and benign.
28func readFileBestEffort(path string) string {
29 b, err := os.ReadFile(path)
30 if err != nil {
31 return ""
32 }
33 return string(b)
34}
35
36// systemTotalMemory returns the container-aware total system RAM in bytes.
37//

Callers 1

systemTotalMemoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected