Documentation
¶
Index ¶
- func DetachSysProcAttr() *syscall.SysProcAttr
- func FindImposterProcesses(matcher ProcessMatcher) ([]engine.ManagedMock, error)
- func OpenDetachLog(path string) (*os.File, error)
- func ReadArg(cmdline []string, longArg string, shortArg string) string
- func StopManagedProcess(matcher ProcessMatcher, id string) (bool, error)
- func StopManagedProcesses(matcher ProcessMatcher) (int, error)
- type ProcessMatcher
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
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 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