MCPcopy Create free account
hub / github.com/cli/cli / Root

Struct Root

internal/safepaths/root.go:17–24  ·  view source on GitHub ↗

Root restricts filesystem operations to a directory tree and refuses to traverse symbolic links below that directory. The caller owns each returned Root and must call Close when it is no longer needed.

Source from the content-addressed store, hash-verified

15// The caller owns each returned Root and must call Close when it is
16// no longer needed.
17type Root struct {
18 root *os.Root
19 openRoot func(*os.Root, string) (*os.Root, error)
20 openFile func(*os.Root, string, int, os.FileMode) (*os.File, error)
21 lstat func(*os.Root, string) (os.FileInfo, error)
22 readlink func(*os.Root, string) (string, error)
23 stat func(*os.Root, string) (os.FileInfo, error)
24}
25
26// OpenRoot opens an existing directory as a rooted filesystem.
27func OpenRoot(path string) (*Root, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected