Help us shape the future of Go! Take the 2026 Go Developer Survey

osutil

package
v1.3.103 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package osutil pkg/util/osutil/errors.go c0-com-util

Package osutil pkg/util/osutil/osutil.go c0-com-util

Package osutil pkg/util/osutil/path_check_unix.go c0-com-util

Package osutil pkg/util/osutil/privileges_unix.go c0-com-util

Package osutil pkg/util/osutil/run.go c0-com-util

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GainRoot

func GainRoot() (int, error)

GainRoot escalates privileges to gain root access. Returns `uid` to be stored.

func ReleaseRoot

func ReleaseRoot(oldUID int) error

ReleaseRoot releases root privileges, setting `oldUID`.

func Run

func Run(bin string, args ...string) error

Run runs binary `bin` with `args`.

func RunElevated

func RunElevated(bin string, args ...string) error

RunElevated runs binary with escalation (admin / root)

func RunElevatedWithResult

func RunElevatedWithResult(bin string, args ...string) ([]byte, error)

RunElevatedWithResult runs binary `bin` with `args` returning stdout contents as bytes.

func RunElevatedWithResultReader

func RunElevatedWithResultReader(bin string, args ...string) (io.Reader, error)

RunElevatedWithResultReader runs binary `bin` with `args` returning stdout contents as `io.Reader`

func RunWithResult

func RunWithResult(bin string, args ...string) ([]byte, error)

RunWithResult runs binary `bin` with `args` returning stdout contents as bytes.

func RunWithResultReader

func RunWithResultReader(bin string, args ...string) (io.Reader, error)

RunWithResultReader runs binary `bin` with `args` returning stdout contents as `io.Reader`.

func UnlinkSocketFiles

func UnlinkSocketFiles(socketFiles ...string) error

UnlinkSocketFiles removes unix socketFiles from file system

Types

type ErrorWithStderr

type ErrorWithStderr struct {
	Err    error
	Stderr []byte
}

ErrorWithStderr is an error raised by the external process. `Err` is an actual error coming from `exec`, while `Stderr` contains stderr output of the process.

func NewErrorWithStderr

func NewErrorWithStderr(err error, stderr []byte) *ErrorWithStderr

NewErrorWithStderr constructs new `ErrorWithStderr`.

func (*ErrorWithStderr) Error

func (e *ErrorWithStderr) Error() string

Error implements `error`.

Jump to

Keyboard shortcuts

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