launch.events.process package

Submodules

Module contents

Package for launch.events.process.

class launch.events.process.ProcessExited[source]

Bases: RunningProcessEvent

Event emitted when a process exits.

__init__(*, returncode: int, **kwargs) None[source]

Create a ProcessExited event.

Unmatched keyword arguments are passed to RunningProcessEvent, see it for details on those arguments.

Param:

returncode is the returncode of the process

name = 'launch.events.process.ProcessExited'
property returncode: int

Getter for returncode.

class launch.events.process.ProcessIO[source]

Bases: RunningProcessEvent

Event emitted when a process generates output on stdout or stderr, or if stdin is used.

__init__(*, text: bytes, fd: int, **kwargs) None[source]

Create a ProcessIO event.

Unmatched keyword arguments are passed to RunningProcessEvent, see it for details on those arguments.

Param:

text is the unicode data associated with the event

Param:

fd is an integer that indicates which file descriptor the text is from

property from_stderr: bool

Getter for from_stderr.

property from_stdin: bool

Getter for from_stdin.

property from_stdout: bool

Getter for from_stdout.

name = 'launch.events.process.ProcessIO'
property text: bytes

Getter for text.

class launch.events.process.ProcessStarted[source]

Bases: RunningProcessEvent

Event emitted when a process starts.

__init__(**kwargs)[source]

Create a ProcessStarted event.

Unmatched keyword arguments are passed to RunningProcessEvent, see it for details on those arguments.

name = 'launch.events.process.ProcessStarted'
class launch.events.process.ProcessStderr[source]

Bases: ProcessIO

Event emitted when a process generates output on stderr.

__init__(*, text: bytes, **kwargs) None[source]

Create a ProcessStderr event.

Unmatched keyword arguments are passed to ProcessEvent, see it for details on those arguments.

Param:

text is the unicode data associated with the event

name = 'launch.events.process.ProcessStderr'
class launch.events.process.ProcessStdin[source]

Bases: ProcessIO

Event emitted when a process needs to handle stdin.

__init__(*, text: bytes, **kwargs) None[source]

Create a ProcessStdin event.

Unmatched keyword arguments are passed to ProcessEvent, see it for details on those arguments.

Param:

text is the unicode data associated with the event

name = 'launch.events.process.ProcessStdin'
class launch.events.process.ProcessStdout[source]

Bases: ProcessIO

Event emitted when a process generates output on stdout.

__init__(*, text: bytes, **kwargs) None[source]

Create a ProcessStdout event.

Unmatched keyword arguments are passed to ProcessEvent, see it for details on those arguments.

Param:

text is the unicode data associated with the event

name = 'launch.events.process.ProcessStdout'
class launch.events.process.ProcessTargetedEvent[source]

Bases: Event

Event base class that is targeted at some running process.

__init__(*, process_matcher: Callable[[ExecuteLocal], bool]) None[source]

Create a ProcessTargetedEvent.

Some standard matchers are also available, like:

Param:

process_matcher is a predicate which can determine if an ExecuteLocal action matches this event or not

name = 'launch.events.process.ProcessTargetedEvent'
property process_matcher: Callable[[ExecuteLocal], bool]

Getter for process_matcher.

class launch.events.process.RunningProcessEvent[source]

Bases: Event

Event base class that is related to some running process.

__init__(*, action: ExecuteProcess, name: str, cmd: List[str], cwd: str | None, env: Dict[str, str] | None, pid: int) None[source]

Create a RunningProcessEvent.

Param:

action is the ExecuteProcess action associated with the event

Param:

name is the final name of the process instance, which is unique

Param:

cmd is the final command after substitution expansion

Param:

cwd is the final working directory after substitution expansion

Param:

env is the final environment variables after substitution expansion

property action: ExecuteProcess

Getter for action.

property cmd: List[str]

Getter for cmd.

property cwd: str | None

Getter for cwd.

property env: Dict[str, str] | None

Getter for env.

property execute_process_action: ExecuteProcess

Getter for execute_process_action.

name = 'launch.events.process.RunningProcessEvent'
property pid: int

Getter for pid.

property process_name: str

Getter for process_name.

class launch.events.process.ShutdownProcess[source]

Bases: ProcessTargetedEvent

Event emitted when a process should begin shutting down.

This event is handled by the launch.actions.ExecuteLocal action, see it for details on what happens when this is emitted.

Also see ProcessTargetedEvent for details on how to target a specific process.

__init__(*, process_matcher: Callable[[ExecuteLocal], bool]) None[source]

Create a ShutdownProcess event.

name = 'launch.events.process.ShutdownProcess'
class launch.events.process.SignalProcess[source]

Bases: ProcessTargetedEvent

Event emitted when a signal should be sent to a process.

__init__(*, signal_number: str | Signals, process_matcher: Callable[[ExecuteLocal], bool]) None[source]

Create a SignalProcess event.

Takes an optional process matcher, which can be used to match the signal to a process.

Since Windows does not support SIGKILL, the string ‘SIGKILL’ can be given instead of signal.SIGKILL. Handlers of this event can then check for the ‘SIGKILL’ string and do the appropriate thing on Windows instead of sending a signal.

Signal_number:

either the string ‘SIGKILL’ or a signal.Signals

name = 'launch.events.process.SignalProcess'
property signal: str | Signals

Getter for signal, it will be ‘SIGKILL’ or match something from the signal module.

property signal_name: str

Getter for signal_name.

It will be something like (e.g.) ‘SIGINT’.

launch.events.process.matches_executable(executable: str) Callable[[ExecuteProcess], bool][source]

Return a matcher which matches based on the name of the executable for the process.

The given executable is compared with the first element of the ‘cmd’ using str.endswith(). So, for example, ‘ls’ would match either ‘ls .’ or ‘/usr/bin/ls .’.

launch.events.process.matches_name(name: str) Callable[[ExecuteProcess], bool][source]

Return a matcher which matches based on the name of the ExecuteProcess action.

launch.events.process.matches_pid(pid: int) Callable[[ExecuteProcess], bool][source]

Return a matcher which matches based on the pid of the process.