process

package
v0.0.0-...-028f1de Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success int = iota
	Fail
	Timeout
)
View Source
const (
	// ExitPlaceholder is simply constatn placeholder for exitcode when failed
	ExitPlaceholderFailed = -1
)

Variables

View Source
var (
	// ErrInvalidState indicates function enters unexpected state and exits. You
	// should never meet such error.
	ErrInvalidState = errors.New("Invalid state encountered")
)
View Source
var ShellPluginCommandArgs = []string{"-c"}
View Source
var ShellPluginCommandName = "sh"

Functions

func CreateLocalAdminUser

func CreateLocalAdminUser(defaultRunAsUserName string) (err error)

func DoesUserExist

func DoesUserExist(username string) (bool, error)

func GetUserCredentials

func GetUserCredentials(sessionUser string) (uint32, uint32, []uint32, error)

func IsUserValid

func IsUserValid(userName string, password string) error

func StrStatus

func StrStatus(status int) string

StrStatus function converts integer status code into string description

func SyncRunDetached

func SyncRunDetached(command string, arguments []string, timeout int) (exitcode int, status int, err error)

SyncRunDetached simply runs command in new session and process group

Types

type CmdOption

type CmdOption func(*exec.Cmd) error

type ProcessCmd

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

func NewProcessCmd

func NewProcessCmd(options ...CmdOption) *ProcessCmd

func (*ProcessCmd) Cancel

func (p *ProcessCmd) Cancel()

func (*ProcessCmd) Pid

func (p *ProcessCmd) Pid() int

func (*ProcessCmd) SetEnv

func (p *ProcessCmd) SetEnv(env []string)

func (*ProcessCmd) SetHomeDir

func (p *ProcessCmd) SetHomeDir(homeDir string)

func (*ProcessCmd) SetPasswordInfo

func (p *ProcessCmd) SetPasswordInfo(password string)

func (*ProcessCmd) SetUserInfo

func (p *ProcessCmd) SetUserInfo(name string)

func (*ProcessCmd) SyncRun

func (p *ProcessCmd) SyncRun(
	workingDir string,
	commandName string,
	commandArguments []string,
	stdoutWriter io.Writer,
	stderrWriter io.Writer,
	stdinReader io.Reader,
	callbackFunc ReadCallbackFunc,
	timeOut int) (exitCode int, status int, err error)

func (*ProcessCmd) SyncRunSimple

func (p *ProcessCmd) SyncRunSimple(commandName string, commandArguments []string, timeOut int) error

type ReadCallbackFunc

type ReadCallbackFunc func(stdoutWriter io.Reader, stderrWriter io.Reader)

type SafeBuffer

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

Buffer is a goroutine safe bytes.Buffer

func (*SafeBuffer) Read

func (s *SafeBuffer) Read(p []byte) (n int, err error)

func (*SafeBuffer) String

func (s *SafeBuffer) String() string

String returns the contents of the unread portion of the buffer as a string. If the Buffer is a nil pointer, it returns "<nil>".

func (*SafeBuffer) Write

func (s *SafeBuffer) Write(p []byte) (n int, err error)

Write appends the contents of p to the buffer, growing the buffer as needed. It returns the number of bytes written.

type WaitProcessResult

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

Jump to

Keyboard shortcuts

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