process

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package process Provide some process handle util functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(pid int) bool

Exists check process running by given pid

func Kill

func Kill(pid int, signal syscall.Signal) error

Kill a process by pid

func KillByName

func KillByName(keywords string, sig syscall.Signal) error

KillByName kill process by name match

func PID

func PID() int

PID get current process ID

func PIDByName

func PIDByName(keywords string) int

PIDByName get PID by process name match

func ProcInfo

func ProcInfo(pid int) (*os.Process, error)

ProcInfo looks for a running process by its pid.

alias of os.FindProcess()

func Start

func Start(name string, argv []string, attr *os.ProcAttr) (*os.Process, error)

Start starts a new process with the program, arguments and attributes specified by name, argv and attr.

alias of os.StartProcess()

Types

type PidFile

type PidFile struct {
	// contains filtered or unexported fields
}

PidFile struct

func NewPidFile

func NewPidFile(file string) *PidFile

NewPidFile instance

func (*PidFile) Exists

func (pf *PidFile) Exists() bool

Exists of th pid file

func (*PidFile) File

func (pf *PidFile) File() string

File path

func (*PidFile) PID

func (pf *PidFile) PID() int

PID value

func (*PidFile) Save

func (pf *PidFile) Save() error

Save PID value to file

func (*PidFile) SetPID

func (pf *PidFile) SetPID(val int) int

SetPID value

func (*PidFile) String

func (pf *PidFile) String() string

String PID value string

Jump to

Keyboard shortcuts

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