pkill

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: MIT Imports: 5 Imported by: 6

README

pkill-go

GoDoc Go Report Card

Like pkill and pgrep, in pure Go without using exec.Cmd.

go get github.com/pbar1/pkill-go
Usage
package main

import (
  "fmt"

  "github.com/pbar1/pkill-go"
)

func main() {
  pids, err := pkill.Pgrep("^go$")
  if err != nil {
    fmt.Println(err)
  }
  for _, pid := range pids {
    fmt.Println(pid)
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pgrep

func Pgrep(expr string) ([]int, error)

Pgrep functions like `pgrep`, returning a list of PIDs by regular expression on their executable name. Note: Both return values may not be nil.

func Pkill

func Pkill(expr string, sig os.Signal) ([]int, error)

Pkill functions like `pkill`, sending a signal to each process found by regular expression on their executable name, and returning a list of PIDs and any errors during execution. Note: Some processes may have been signaled even if this command errors; thus both return values may not be nil.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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