syscall

package
v0.0.0-...-6ac6f58 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitErrorCode            = 99
	DevOPSProcessTreeKillKey = "DEVOPS_DONT_KILL_PROCESS_TREE"
)

Variables

This section is empty.

Functions

func AddPath2Env

func AddPath2Env(p string)

AddPath2Env add path to env

func GetCallerAndOptions

func GetCallerAndOptions() (string, string)

GetCallerAndOptions return the caller and options in unix

func GetConsoleCP

func GetConsoleCP() int

GetConsoleCP only implement for windows now

func GetSysProcAttr

func GetSysProcAttr() *syscall.SysProcAttr

GetSysProcAttr set process group id to a new id, in case of the signals sent to the caller affect the process as well

func RedirectStderror

func RedirectStderror(f string) error

func RunServer

func RunServer(command string) error

RunServer run the detached server

Types

type Sandbox

type Sandbox struct {
	Ctx    context.Context
	Env    *env.Sandbox
	Dir    string
	User   user.User
	Stdout io.Writer
	Stderr io.Writer
	// contains filtered or unexported fields
}

Sandbox describe the handler to build up an isolated execution environment

func (*Sandbox) ExecCommand

func (s *Sandbox) ExecCommand(name string, arg ...string) (int, error)

ExecCommand run the origin commands

func (*Sandbox) ExecCommandWithMessage

func (s *Sandbox) ExecCommandWithMessage(name string, arg ...string) (int, []byte, []byte, error)

ExecCommandWithMessage run the commands and get the stdout and stderr

func (*Sandbox) ExecScripts

func (s *Sandbox) ExecScripts(src string) (int, error)

ExecScripts run the scripts

func (*Sandbox) ExecScriptsWithMessage

func (s *Sandbox) ExecScriptsWithMessage(src string) (int, []byte, []byte, error)

ExecScriptsWithMessage run the scripts and return the output

func (*Sandbox) Fork

func (s *Sandbox) Fork() *Sandbox

Fork return a new sandbox which inherits from current one

func (*Sandbox) GetAbsPath

func (s *Sandbox) GetAbsPath(path string) string

GetAbsPath return the abs path related to current running dir

func (*Sandbox) GetDir

func (s *Sandbox) GetDir() string

GetDir return the running dir

func (*Sandbox) LookPath

func (s *Sandbox) LookPath(file string) (string, error)

LookPath 根据sandbox中的env-PATH, 来取得正确的command-name路径

func (*Sandbox) StartCommand

func (s *Sandbox) StartCommand(name string, arg ...string) (*exec.Cmd, error)

StartCommand start the origin commands

func (*Sandbox) StartScripts

func (s *Sandbox) StartScripts(src string) (*exec.Cmd, error)

StartScripts run the scripts

Jump to

Keyboard shortcuts

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