Documentation ¶
Index ¶
- Variables
- type CmdResult
- type SysManager
- func (s *SysManager) CopyFileAttribute(from, to string) error
- func (s *SysManager) CreateFileForWrite(file string, user *User, perm os.FileMode) (io.WriteCloser, error)
- func (s *SysManager) FileExists(name string) (bool, error)
- func (s *SysManager) GetUserByName(username string) (*User, error)
- func (s *SysManager) MkDirIfNonExist(dir string, user *User, perm os.FileMode) error
- func (s *SysManager) ReadFile(filename string) ([]byte, error)
- func (s *SysManager) RemoveFile(name string) error
- func (s *SysManager) RenameFile(oldpath, newpath string) error
- func (s *SysManager) RunCmd(name string, arg ...string) (*CmdResult, error)
- func (s *SysManager) Sleep(d time.Duration)
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrGetUserFailed indicates the system call for fetching user entry from passwd has failed ErrGetUserFailed = fmt.Errorf("failed to get user") // ErrUserNotFound indicates the user does not exist in the system ErrUserNotFound = fmt.Errorf("user not found") // ErrMakeDirFailed indicates the system call for making a directory has failed ErrMakeDirFailed = fmt.Errorf("failed to make directory") // ErrCreateFileFailed indicates the error of failing to create a file ErrCreateFileFailed = fmt.Errorf("failed to create file") // ErrRunCmdFailed is returned when a command is failed to run ErrRunCmdFailed = fmt.Errorf("failed to run command") )
Possible errors
Functions ¶
This section is empty.
Types ¶
type SysManager ¶
type SysManager struct {
// contains filtered or unexported fields
}
SysManager is the tool for interacting with the OS
func (*SysManager) CopyFileAttribute ¶
func (s *SysManager) CopyFileAttribute(from, to string) error
CopyFileAttribute copies a file's attribute to another In Linux, this is specifically designed to apply the selinux labels of a file to another
func (*SysManager) CreateFileForWrite ¶
func (s *SysManager) CreateFileForWrite(file string, user *User, perm os.FileMode) (io.WriteCloser, error)
CreateFileForWrite creates a file for write
func (*SysManager) FileExists ¶
func (s *SysManager) FileExists(name string) (bool, error)
FileExists checks whether a file exists or not
func (*SysManager) GetUserByName ¶
func (s *SysManager) GetUserByName(username string) (*User, error)
GetUserByName gets an OS user info
func (*SysManager) MkDirIfNonExist ¶
MkDirIfNonExist creates a directory if it does not exist
func (*SysManager) ReadFile ¶
func (s *SysManager) ReadFile(filename string) ([]byte, error)
ReadFile reads a file
func (*SysManager) RemoveFile ¶
func (s *SysManager) RemoveFile(name string) error
RemoveFile removes a file
func (*SysManager) RenameFile ¶
func (s *SysManager) RenameFile(oldpath, newpath string) error
RenameFile renames a file
func (*SysManager) RunCmd ¶
func (s *SysManager) RunCmd(name string, arg ...string) (*CmdResult, error)
RunCmd runs a command and return the result
func (*SysManager) Sleep ¶
func (s *SysManager) Sleep(d time.Duration)
Click to show internal directories.
Click to hide internal directories.