os

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFileContents

func CopyFileContents(src string, dst string, permission os.FileMode) error

func FileExists

func FileExists(path string) bool

func RemoveFileAsRoot

func RemoveFileAsRoot(reason, filepath string) error

func ReplaceEnv

func ReplaceEnv(variables []string, varName string, value string) []string

ReplaceEnv changes the value of an environment variable It drops the existing value and appends the new value in-place

func RunWithDefaultLocale

func RunWithDefaultLocale(command string, args ...string) (string, string, error)

func RunWithDefaultLocalePrivate

func RunWithDefaultLocalePrivate(command string, args ...string) (string, string, error)

func RunWithPrivilege

func RunWithPrivilege(reason string, cmdAndArgs ...string) (string, string, error)

RunWithPrivilege executes a command using sudo provide a reason why root is needed as the first argument

func WriteFileIfContentChanged

func WriteFileIfContentChanged(path string, new_content []byte, perm os.FileMode) (bool, error)

func WriteToFileAsRoot

func WriteToFileAsRoot(reason, content, filepath string, mode os.FileMode) error

Types

type OS

type OS string
const (
	LINUX   OS = "linux"
	DARWIN  OS = "darwin"
	WINDOWS OS = "windows"
)

func CurrentOS

func CurrentOS() OS

func (OS) String

func (t OS) String() string

Directories

Path Synopsis
windows

Jump to

Keyboard shortcuts

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