added checking of result when building demos
[urisagit/Stem.git] / Design / proc_notes
1 Stem::Proc
2
3 A major service in network management infrastructure is running and 
4 controlling processes.  Stem::Proc is a very simple to use cell which 
5 has a wide range of useful options to control the process behavior 
6 and its standard I/O.  The required parameters to the cell specify 
7 the program  and its arguments.   
8
9 The first group of configuration parameters controls how and when the 
10 process is actually started.  A process can be started at 
11 configuration time or initiated by a command message.  The message 
12 interface is very important as it allows process management from any 
13 other cell, including Stem::Cron (this will allow emulation of the OS 
14 cron running processes), Stem::SockMsg (this will allow emulation 
15 of the OS inetd), and other similar needs for remote process 
16 invocation.  Process monitoring is achieved by handling SIGCHLD 
17 signals and I/O handle shut-down detection.  A message can be sent 
18 upon process exiting and the process can optionally be restarted 
19 automatically, giving you a watchdog service.
20
21 The second group is much larger and controls the I/O behavior of the 
22 process.  You can enable/disable any subset of its 
23 stdin/stdout/stderr handles.  This is needed for processes that don't 
24 use all of their standard I/O handles.  Process I/O can be managed by 
25 the Stem::AsyncIO class and callbacks.  In addition, the cell can be 
26 configured to transfer its I/O data to/from other cells via Stem 
27 messages.  One neat feature is the ability to buffer all output from 
28 a process and send it via a message only upon process exit.  This 
29 emulates the running of a process in backquotes as supported by 
30 shells and Perl.
31
32 Processes that need to work with a terminal can optionally be run 
33 behind a pseudo-TTY device. 
34