Movatterモバイル変換


[0]ホーム

URL:


reaper

package
v2.23.0Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:5Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Overview

Package reaper contains logic for reaping subprocesses. It isspecifically used in the agent to avoid the accumulation ofzombie processes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcForkReap

func ForkReap(opt ...Option)error

ForkReap spawns a goroutine that reaps children. In order to avoidcomplications with spawning `exec.Commands` in the same process thatis reaping, we forkexec a child process. This prevents a race betweenthe reaper and an exec.Command waiting for its process to complete.The provided 'pids' channel may be nil if the caller does not care about thereaped children PIDs.

funcIsInitProcess

func IsInitProcess()bool

IsInitProcess returns true if the current process's PID is 1.

Types

typeOption

type Option func(o *options)

funcWithCatchSignals

func WithCatchSignals(sigs ...os.Signal)Option

WithCatchSignals sets the signals that are caught and forwarded to thechild process. By default no signals are forwarded.

funcWithExecArgs

func WithExecArgs(args ...string)Option

WithExecArgs specifies the exec arguments for the fork exec call.By default the same arguments as the parent are used as dictated byos.Args. Since ForkReap calls a fork-exec it is the responsibility ofthe caller to avoid fork-bombing oneself.

funcWithPIDCallback

func WithPIDCallback(ch reap.PidCh)Option

WithPIDCallback sets the channel that reaped child process PIDs are pushedonto.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp