util

package
v1.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package util provides utilities for the gomcp library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProcessGroupManager

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

ProcessGroupManager provides enhanced process cleanup capabilities that work in conjunction with the MCP ServerRegistry to prevent orphan processes.

func NewProcessGroupManager

func NewProcessGroupManager() *ProcessGroupManager

NewProcessGroupManager creates a new process group manager.

func (*ProcessGroupManager) CleanupAllProcessGroups

func (pgm *ProcessGroupManager) CleanupAllProcessGroups(timeout time.Duration) error

CleanupAllProcessGroups forcefully terminates all tracked process groups. This is a nuclear option for application shutdown.

func (*ProcessGroupManager) GetTrackedProcessGroups

func (pgm *ProcessGroupManager) GetTrackedProcessGroups() int

GetTrackedProcessGroups returns the number of currently tracked process groups.

func (*ProcessGroupManager) PrepareCommand

func (pgm *ProcessGroupManager) PrepareCommand(cmd *exec.Cmd) error

PrepareCommand configures a command to run in its own process group for enhanced cleanup capabilities. This should be called before cmd.Start().

func (*ProcessGroupManager) RegisterProcessGroup

func (pgm *ProcessGroupManager) RegisterProcessGroup(cmd *exec.Cmd) error

RegisterProcessGroup registers a process group for cleanup tracking. Call this after cmd.Start() succeeds.

func (*ProcessGroupManager) TerminateProcessGroup

func (pgm *ProcessGroupManager) TerminateProcessGroup(cmd *exec.Cmd, timeout time.Duration) error

TerminateProcessGroup terminates a process group more aggressively than the standard ServerRegistry termination. This kills the entire process tree.

Directories

Path Synopsis
Package conversion provides utilities for converting between types.
Package conversion provides utilities for converting between types.
Package schema provides utilities for generating JSON Schema from Go structs.
Package schema provides utilities for generating JSON Schema from Go structs.

Jump to

Keyboard shortcuts

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