MCPcopy Index your code
hub / github.com/google/gvisor / createParserBinary

Function createParserBinary

tools/nvidia_driver_differ/run_differ.go:42–62  ·  view source on GitHub ↗

createParserBinary creates a temporary file containing the driver_ast_parser binary, and returns the path to it.

()

Source from the content-addressed store, hash-verified

40// createParserBinary creates a temporary file containing the driver_ast_parser
41// binary, and returns the path to it.
42func createParserBinary() (string, error) {
43 tmpFile, err := os.CreateTemp(os.TempDir(), "driver_ast_parser_*")
44 if err != nil {
45 return "", fmt.Errorf("failed to create temporary file: %w", err)
46 }
47 defer func() {
48 if err := tmpFile.Close(); err != nil {
49 log.Warningf("failed to close driver_ast_parser binary: %w", err)
50 }
51 }()
52
53 if _, err := tmpFile.Write(driverParserBinary); err != nil {
54 return "", fmt.Errorf("failed to write to temporary file: %w", err)
55 }
56
57 if err := tmpFile.Chmod(0500); err != nil {
58 return "", fmt.Errorf("failed to make file executable: %w", err)
59 }
60
61 return tmpFile.Name(), nil
62}
63
64// Main is the main function for the NVIDIA driver differ.
65func Main() error {

Callers 1

MainFunction · 0.85

Calls 5

WarningfFunction · 0.92
ErrorfMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…