Skip to main content

Mojo struct

ProcessStatus

struct ProcessStatus

Represents the termination status of a process.

This struct is returned by poll() and wait().

Fields

  • exit_code (Optional[Int]): The exit code if the process terminated normally.
  • term_signal (Optional[Int]): The signal number that terminated the process.

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable

comptime members

__copyinit__is_trivial

comptime __copyinit__is_trivial = _all_trivial_copyinit[_NoneType, Int]()

__del__is_trivial

comptime __del__is_trivial = _all_trivial_del[_NoneType, Int]()

__moveinit__is_trivial

comptime __moveinit__is_trivial = _all_trivial_moveinit[_NoneType, Int]()

Methods

__init__

__init__(out self, exit_code: Optional[Int] = None, term_signal: Optional[Int] = None)

Initializes a new ProcessStatus.

Args:

  • exit_code (Optional): The exit code if the process terminated normally.
  • term_signal (Optional): The signal number that terminated the process.

running

static running() -> Self

Creates a status for a running process.

Returns:

Self: A ProcessStatus for a running process.

has_exited

has_exited(self) -> Bool

Checks if the process has terminated.

Returns:

Bool: True if the process has terminated, either normally or by a signal.

Was this page helpful?