procutil

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetachSysProcAttr added in v1.8.0

func DetachSysProcAttr() *syscall.SysProcAttr

DetachSysProcAttr returns the SysProcAttr needed to start a child process in its own session so it survives the parent CLI exiting and the controlling terminal closing.

func FindImposterProcesses

func FindImposterProcesses(matcher ProcessMatcher) ([]engine.ManagedMock, error)

FindImposterProcesses finds all imposter processes matching the given matcher

func OpenDetachLog added in v1.8.0

func OpenDetachLog(path string) (*os.File, error)

OpenDetachLog opens (creating directories and file as needed) the log file a detached process engine writes its stdout/stderr to. The file is opened in append mode so restarts do not truncate prior output.

func ReadArg

func ReadArg(cmdline []string, longArg string, shortArg string) string

ReadArg parses the command line arguments to find the value of a given argument

func StopManagedProcess added in v1.8.0

func StopManagedProcess(matcher ProcessMatcher, id string) (bool, error)

StopManagedProcess kills the single managed process whose PID matches id, provided it satisfies matcher. Returns (true, nil) if killed, (false, nil) if no matching process exists, (false, err) on lookup/kill errors.

func StopManagedProcesses

func StopManagedProcesses(matcher ProcessMatcher) (int, error)

StopManagedProcesses stops all processes matching the given matcher

Types

type ProcessMatcher

type ProcessMatcher struct {
	// ProcessName is the name of the process to match (e.g., "java" or "imposter")
	ProcessName string
	// CommandPattern is a regex pattern to match against command line arguments
	CommandPattern string
	// GetPort is a function that determines the port from command line arguments
	GetPort func(cmdline []string, env []string) int
}

ProcessMatcher defines how to identify a specific type of imposter process

Jump to

Keyboard shortcuts

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