MCPcopy Index your code
hub / github.com/getsops/sops / GetFile

Function GetFile

cmd/sops/subcommand/exec/exec.go:38–57  ·  view source on GitHub ↗
(dir, filename string)

Source from the content-addressed store, hash-verified

36}
37
38func GetFile(dir, filename string) (*os.File, error) {
39 // If no filename is provided, create a random one based on FallbackFilename
40 if filename == "" {
41 handle, err := os.CreateTemp(dir, FallbackFilename)
42 if err != nil {
43 return nil, err
44 }
45 return handle, nil
46 }
47 // If a filename is provided, use that one
48 handle, err := os.Create(filepath.Join(dir, filename))
49 if err != nil {
50 return nil, err
51 }
52 // read+write for owner only
53 if err = handle.Chmod(0600); err != nil {
54 return nil, err
55 }
56 return handle, nil
57}
58
59func ExecWithFile(opts ExecOpts) error {
60 var userEnv []string

Callers 1

ExecWithFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected