runtime

package
v15.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2019 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowError

func AllowError(errString string, command string, args ...string) (bool, error)

Runs command `command` with arguments `args`. If standard error from command includes `errString` then true, is returned with no error. Otherwise false is returned, with or without an error.

func CommandOutputOrPanic

func CommandOutputOrPanic(command string, args ...string) string

func DeleteUser

func DeleteUser(username string) (err error)

func Error

func Error(c *exec.Cmd) ([]byte, error)

Error runs the command and returns its standard error.

func GeneratePassword

func GeneratePassword() string

Uses [A-Za-z0-9] characters (default set) to avoid strange escaping problems that could potentially affect security. Prefixed with `pWd0_` to ensure password contains a special character (_), lowercase and uppercase letters, and a number. This is useful if the OS has a strict password policy requiring all of these. The total password length is 29 characters (24 of which are random). 29 characters should not be too long for the OS. The 24 random characters of [A-Za-z0-9] provide (26+26+10)^24 possible permutations (approx 143 bits of randomness). Randomisation is not seeded, so results should not be reproducible.

func InteractiveUsername

func InteractiveUsername() (string, error)

func ListUserAccounts

func ListUserAccounts() (usernames []string, err error)

func ProcessCommandOutput

func ProcessCommandOutput(lineEnding string, callback func(line string), prog string, options ...string) error

func RunCommands

func RunCommands(allowFail bool, commands ...[]string) error

func SetAutoLogin

func SetAutoLogin(user *OSUser) error

func UserHomeDirectoriesParent

func UserHomeDirectoriesParent() string

func WaitForLoginCompletion

func WaitForLoginCompletion(timeout time.Duration) error

Types

type OSUser

type OSUser struct {
	Name     string `json:"name"`
	Password string `json:"password"`
}

func AutoLogonCredentials

func AutoLogonCredentials() (user OSUser)

func (*OSUser) CreateNew

func (user *OSUser) CreateNew(okIfExists bool) (err error)

Jump to

Keyboard shortcuts

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