common

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DaemonSocketAddr string = "/var/jobber_daemon.sock"
)

Variables

View Source
var ErrLogger *log.Logger = log.New(os.Stderr, "", 0)
View Source
var Logger *log.Logger = log.New(os.Stdout, "", 0)

Functions

func AllUsersWithSockets added in v1.3.0

func AllUsersWithSockets() ([]*user.User, error)

Get a list of all users for whom there is a jobberrunner process.

func Chown added in v1.3.0

func Chown(path string, usr *user.User) error

func CmdSocketPath added in v1.3.0

func CmdSocketPath(usr *user.User) string

func EtcDirPath added in v1.4.2

func EtcDirPath() string

func InitSettings added in v1.4.2

func InitSettings(params InitSettingsParams) error

func JobberShouldRunForUser added in v1.4.2

func JobberShouldRunForUser(usr *user.User) bool

func LibexecDirPath added in v1.4.2

func LibexecDirPath() string

func LibexecProgramPath added in v1.4.2

func LibexecProgramPath(name string) string

func LogAllToStderr added in v1.4.2

func LogAllToStderr()

func LogToStdoutStderr added in v1.3.0

func LogToStdoutStderr()

func LongVersionStr

func LongVersionStr() string

func MakeCmdExitedChan added in v1.3.0

func MakeCmdExitedChan(cmd *exec.Cmd) <-chan error

func MakeDefaultPrefs added in v1.4.2

func MakeDefaultPrefs(params InitSettingsParams) string

func PerUserDirPath added in v1.3.0

func PerUserDirPath(usr *user.User) string

func PrintPaths added in v1.4.2

func PrintPaths()

func SetLogFile added in v1.3.0

func SetLogFile(paths ...string)

func ShortVersionStr

func ShortVersionStr() string

func Sudo

func Sudo(usr user.User, cmdStr string) *exec.Cmd

Returns an unstarted process descriptor.

func TempDirPath added in v1.4.2

func TempDirPath() string

func UseSyslog added in v1.3.0

func UseSyslog() error

func UserOwnsFile added in v1.3.0

func UserOwnsFile(usr *user.User, path string) (bool, error)

func UserOwnsFileF added in v1.3.0

func UserOwnsFileF(usr *user.User, f *os.File) (bool, error)

func VarDirPath added in v1.3.0

func VarDirPath() string

Types

type Error

type Error struct {
	What  string
	Cause error
}

func (*Error) Error

func (e *Error) Error() string

type ExecResult added in v1.3.0

type ExecResult struct {
	Stdout io.ReadSeeker
	Stderr io.ReadSeeker
	Fate   SubprocFate
}

An ExecResult describes the result of running a subprocess via ExecAndWait. Stdout and Stderr can be used to get the subprocess's stdout and stderr. When done with this object (e.g., when done reading Stdout/Stderr), you must call Close.

func ExecAndWait added in v1.3.0

func ExecAndWait(args []string, input []byte) (*ExecResult, error)

func ExecAndWaitContext added in v1.4.3

func ExecAndWaitContext(ctx context.Context, args []string, input []byte) (*ExecResult, error)

func (*ExecResult) Close added in v1.4.3

func (self *ExecResult) Close()

func (*ExecResult) ReadStderr added in v1.4.3

func (self *ExecResult) ReadStderr(max int) ([]byte, error)

func (*ExecResult) ReadStdout added in v1.4.3

func (self *ExecResult) ReadStdout(max int) (data []byte, err error)

type InitSettingsParams added in v1.4.2

type InitSettingsParams struct {
	VarDir     *string
	LibexecDir *string
	TempDir    *string
	EtcDir     *string
}

type SubprocFate added in v1.4.3

type SubprocFate int
const (
	SubprocFateSucceeded SubprocFate = iota
	SubprocFateFailed    SubprocFate = iota
	SubprocFateCancelled SubprocFate = iota
)

func (SubprocFate) String added in v1.4.3

func (self SubprocFate) String() string

type UserSpec added in v1.4.2

type UserSpec struct {
	Username string
	Home     string
}

Jump to

Keyboard shortcuts

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