Crate swarm_commander

Source
Expand description

This crate is meant to handle tons of commands (processes) in a simple and powerful way. The idea is that you only have to send the command and process the stderr and stdout in an asynchronous way. But always controlling the status of the commands (start, stop, if exit know the reason…)

Check the function run_hive to see an example of use

Structs§

Hive
The place where all of your commands are living
ProcInfo
Public information about a running process
RunnerLogEvent
The last lines of the command. It is useful when debugging because in case of unexpected error, most of times the command just explains you what happened
RunnerStartEvent
When a start event finished this data is filled and returned. Pid is 0 in case of error
RunnerStopEvent
When a stop event finished this data is filled and returned.
StatusEvent
It references the id of the process and the content is generic. You decide what to store in the field data.

Enums§

RunnerEvent
All the events that a command can send during its lifecycle
StdType
The event source, stderr or stdout

Functions§

run_hive
The most important part and the thing that you have to use. It creates an enviroment where your command can live, enjoy and die. The lifecycle. You are the queen of this hive so you decide what commands are created, how many and when they will die. All data that comes from the commands will be sent to the client_event_notifier provided.