MCPcopy Index your code
hub / github.com/kopia/kopia / createUnixFallback

Function createUnixFallback

internal/tempfile/tempfile_unix_fallback.go:12–25  ·  view source on GitHub ↗

createUnixFallback creates a temporary file that does not need to be removed on close.

()

Source from the content-addressed store, hash-verified

10
11// createUnixFallback creates a temporary file that does not need to be removed on close.
12func createUnixFallback() (*os.File, error) {
13 f, err := os.CreateTemp("", "kt-")
14 if err != nil {
15 return nil, err //nolint:wrapcheck
16 }
17
18 // immediately remove/unlink the file while we keep the handle open.
19 if derr := os.Remove(f.Name()); derr != nil {
20 f.Close() //nolint:errcheck
21 return nil, errors.Wrap(derr, "unable to unlink temporary file")
22 }
23
24 return f, nil
25}

Callers 2

CreateAutoDeleteFunction · 0.85
CreateAutoDeleteFunction · 0.85

Calls 4

CreateTempMethod · 0.65
RemoveMethod · 0.65
NameMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected