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

procevent

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package procevent waits for process exit and directory changes through OS notifications. There is no polling and no deadline: a wait ends when a notification arrives. darwin uses kqueue, and linux uses pidfd and inotify.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alive

func Alive(pid int) bool

Alive reports whether the process with pid exists. A process of another user (EPERM) also counts as existing.

func WatchDir

func WatchDir(path string) (func() error, func() error, error)

WatchDir registers changes of the directory (an entry is created, removed, or moved) with inotify, and returns a function that waits for the next change and a function that closes the watch and returns the error of closing it. Registration happens before the state is read, so no change between them is missed.

func WatchExit

func WatchExit(pid int) (func() error, error)

WatchExit opens the pidfd of pid, and returns a function that waits with poll until the pidfd becomes readable, which happens when the process ends. A process that is already gone gives unix.ESRCH.

Types

This section is empty.

Jump to

Keyboard shortcuts

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