utils

package module
v0.0.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 13 Imported by: 4

README

utils

utils for go

Tip!!!

If you get this when running your program:

fork/exec xxxxx: operation not permitted

Please use it as root or sudo.

or remove syscall.ProcAttr.Credential or call SetNoSetGroups(true)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckProcStateIsStopped added in v0.0.15

func CheckProcStateIsStopped(pid int) (bool, error)

func IsExist

func IsExist(path string) bool

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

func NewCmd

func NewCmd() *Command

func NewCommand

func NewCommand() *Command

func (*Command) CheckRoot

func (c *Command) CheckRoot() error

func (*Command) Close added in v0.0.8

func (c *Command) Close()

func (*Command) Command added in v0.0.2

func (c *Command) Command(cmdl string, args ...string) (pid int, err error)

func (*Command) GetOutput

func (c *Command) GetOutput() ([]byte, error)

func (*Command) GetPid added in v0.0.2

func (c *Command) GetPid() int

func (*Command) GetStderrOutput added in v0.0.3

func (c *Command) GetStderrOutput() ([]byte, error)

func (*Command) GetUser

func (c *Command) GetUser() *UserAccount

func (*Command) Lsof

func (c *Command) Lsof(path string) (output []byte, err error)

func (*Command) Mkdir

func (c *Command) Mkdir(path string, perm os.FileMode) (output []byte, err error)

func (*Command) NeedInput added in v0.0.11

func (c *Command) NeedInput(text string)

func (*Command) Pause added in v0.0.12

func (c *Command) Pause() error

func (*Command) Resume added in v0.0.12

func (c *Command) Resume() error

func (*Command) Run added in v0.0.2

func (c *Command) Run() (output []byte, err error)

func (*Command) RunCommand

func (c *Command) RunCommand(cmdl string, args ...string) (output []byte, err error)

func (*Command) SetDebug

func (c *Command) SetDebug(debug bool) *Command

func (*Command) SetEnv added in v0.0.24

func (c *Command) SetEnv(envs []string) *Command

func (*Command) SetNoSetGroups added in v0.0.24

func (c *Command) SetNoSetGroups(noSetGroups bool) *Command

func (*Command) SetSysCredential added in v0.0.24

func (c *Command) SetSysCredential(credential syscall.Credential) *Command

func (*Command) SetSysProcAttr added in v0.0.7

func (c *Command) SetSysProcAttr(procAttr syscall.SysProcAttr) *Command

func (*Command) SetTimeout added in v0.0.6

func (c *Command) SetTimeout(t time.Duration) *Command

func (*Command) SetUser

func (c *Command) SetUser(u *user.User)

func (*Command) SetUsername

func (c *Command) SetUsername(username string) error

func (*Command) SetWorkDir added in v0.0.6

func (c *Command) SetWorkDir(wd string) *Command

type IOReadCloser added in v0.0.26

type IOReadCloser struct {
	// contains filtered or unexported fields
}

func NewReader added in v0.0.26

func NewReader(io io.ReadCloser) *IOReadCloser

func (*IOReadCloser) Bytes added in v0.0.26

func (io *IOReadCloser) Bytes() []byte

func (*IOReadCloser) Read added in v0.0.26

func (io *IOReadCloser) Read() (string, error)

type UserAccount added in v0.0.26

type UserAccount struct {
	// contains filtered or unexported fields
}

func NewFromUser added in v0.0.26

func NewFromUser(user *user.User) *UserAccount

func NewFromUsername added in v0.0.26

func NewFromUsername(username string) (*UserAccount, error)

func NewUserAccount added in v0.0.26

func NewUserAccount() *UserAccount

func (*UserAccount) GetGid added in v0.0.26

func (c *UserAccount) GetGid() int

func (*UserAccount) GetGid_ui32 added in v0.0.26

func (c *UserAccount) GetGid_ui32() uint32

func (*UserAccount) GetUid added in v0.0.26

func (c *UserAccount) GetUid() int

func (*UserAccount) GetUid_ui32 added in v0.0.26

func (c *UserAccount) GetUid_ui32() uint32

func (*UserAccount) GetUser added in v0.0.26

func (c *UserAccount) GetUser() *user.User

func (*UserAccount) SetGid added in v0.0.26

func (c *UserAccount) SetGid(g uint64)

func (*UserAccount) SetUid added in v0.0.26

func (c *UserAccount) SetUid(u uint64)

func (*UserAccount) SetUser added in v0.0.26

func (c *UserAccount) SetUser(u *user.User)

func (*UserAccount) SetUsername added in v0.0.26

func (c *UserAccount) SetUsername(username string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL