osutil

package
v0.0.0-...-1fa5987 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvMapToDotEnv

func EnvMapToDotEnv(m map[string]string) []string

Convert an environment map to a slice of strings suitable for a .env file. Entries are of the form name=value and sorted. Values are shell-quoted.

func EnvMapToEnvv

func EnvMapToEnvv(m map[string]string) []string

Convert an environment map to a slice of strings suitable for exec. Entries are of the form name=value and sorted. No escaping is performed.

func Exists

func Exists(filePath string) (bool, error)

func FindProcess

func FindProcess(pid int) *os.Process

func FormatDotEnvEntry

func FormatDotEnvEntry(name, value string) string

Creates entries of the form name=value. Values are shell-quoted.

func FormatEnvvEntry

func FormatEnvvEntry(name, value string) string

Returns an entry in the form name=value. No escaping is performed.

func IsSymlink(filePath string) (bool, error)

func IsValidPid

func IsValidPid(pid int) bool

func IsWritable

func IsWritable(filePath string) (bool, error)

func KillGroup

func KillGroup(pgid int) error

func KillProcess

func KillProcess(pid int) error

func ParseEnvvEntry

func ParseEnvvEntry(entry string) (name, value string)

Parses an name=value entry where the value is returned literally.

func ShutdownGroup

func ShutdownGroup(ctx context.Context, gpid int) error

func ShutdownProcess

func ShutdownProcess(ctx context.Context, pid int) error

Terminates pid, then if context is cancelled, kills pid.

func SignalGroup

func SignalGroup(pgid int, sig os.Signal) error

func SignalProcess

func SignalProcess(pid int, sig os.Signal) error

func TerminateGroup

func TerminateGroup(pgid int) error

func TerminateGroupWithTimeout

func TerminateGroupWithTimeout(pgid int, timeout time.Duration) error

func TerminateProcess

func TerminateProcess(pid int) error

func TerminateProcessWithTimeout

func TerminateProcessWithTimeout(pid int, timeout time.Duration) error

func WaitProcess

func WaitProcess(pid int) (*os.ProcessState, error)

func WriteFileSync

func WriteFileSync(name string, data []byte, perm fs.FileMode) error

TODO: This might not actually help anything. See <https://twitter.com/tomfaulhaber/status/1447376910531448832>.

Types

This section is empty.

Jump to

Keyboard shortcuts

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