processEventStream

fnProcessEventRange processEventStream(Duration pollInterval = dur!"msecs"(100))

Creates a process event stream for reactive monitoring.

This function returns a range that yields ProcessEvent objects as they occur. The range can be used with D's range-based algorithms for filtering, mapping, and other operations.

Parameters

pollIntervalThe interval for polling process changes (default: 100ms).

Returns

A ProcessEventRange that yields process events.

Example:

auto stream = processEventStream();

// Process events as they occur
foreach (event; stream) {
   final switch (event.type) {
       case ProcessEventType.CREATED:
           writeln("Process created: ", event.pid);
           break;
       case ProcessEventType.TERMINATED:
           writeln("Process terminated: ", event.pid);
           break;
       case ProcessEventType.STATUS_CHANGED:
           writeln("Process status changed: ", event.pid);
           break;
   }

   if (someCondition) {
       stream.stop();
       break;
   }
}