proc

package module
v0.0.0-...-a443bc2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger io.Writer

Functions

func Cancel

func Cancel(ids ...uint32)

func Context

func Context() context.Context

Context return the process context.

func Name

func Name() string

Name returns the process name, same as the command name.

func Notify

func Notify(sig os.Signal) bool

func On

func On(sig os.Signal, fn func()) uint32

func Once

func Once(sig os.Signal, fn func()) uint32

func Path

func Path(components ...string) string

Path returns a path with components of the working directory

func Pathf

func Pathf(format string, args ...any) string

Pathf returns a path with format of the working directory.

func Pid

func Pid() int

Pid returns pid of the current process.

func SetSysProcAttribute

func SetSysProcAttribute(cmd *exec.Cmd)

SetSysProcAttribute sets the common SysProcAttrs for commands

func SetTimeToForceQuit

func SetTimeToForceQuit(duration time.Duration)

SetTimeToForceQuit sets the waiting time before force quitting.

func Shutdown

func Shutdown(sig syscall.Signal) error

Shutdown calls the registered shutdown listeners, only for test purpose.

func WorkDir

func WorkDir() string

WorkDir returns working directory of the current process.

Types

type ExecOptions

type ExecOptions struct {
	WorkDir string
	Timeout time.Duration
	Env     []string
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
	Command string
	Args    []string
	TTK     time.Duration // time to kill
	OnStart func(cmd *exec.Cmd)
}

Jump to

Keyboard shortcuts

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