includefile(include/header)

COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::Process)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_-x.tar.gz)
                    (Running Child Processes)

manpagename(FBB::Process)(Runs external programs)

manpagesynopsis()
    bf(#include <bobcat/process>)nl()
    Linking option: tt(-lbobcat) 

manpagedescription()
    The bf(FBB::Process) class offers an extensive interface to calling
external programs and/or scripts from a bf(C++) program (so-called
em(child-processes)). The class offers an easy to use, stream-based interface
to the standard input, standard output and standard error streams of child
processes.

    Objects of the tt(class Process) use standard process-executing functions,
like members of the bf(execl)(1) family or bf(sh)(1) to execute child
processes. Thus, child processes can be executable programs or
em(shell-scripts).

The standard input, output and error streams of child processes may
be accessed through their tt(Process) parent objects. Input expected by child
processes may be inserted by tt(Process) objects, and output generated by
child processes may be extracted from tt(Process) objects. 

When using (output) redirection with the tt(USE_SHELL) path specification (see
below for the path and IOMode specifications), the tt(IGNORE_COUT IOMode) (and
possibly tt(IGNORE_CERR)) should normally be specified (see also this
man-page's bf(PIPING) section).

tt(Process) objects may repeatedly be used to execute the same or different
child processes. Before the next child process is started, the tt(Process)
object first terminates its currently active child process. Alternatively, a
currently active child process is automatically ended if the tt(Process)
object goes out of scope, if its tt(stop) or tt(eoi) (end-of-information)
member is called, or if the tt(eoi) manipulator is inserted into the
tt(Process) object.

Programs to be called as child processes may be specified at tt(Process's)
constructor-time or through tt(Process's setCommand) member. tt(Process)
constructors (or tt(Process set)-members) never start child processes. Child
processes are started through tt(start) members or the assignment operator.

Child processes may receive information at their standard input streams
through information inserted into tt(Process) objects. In these cases the
tt(Process) objects must inform their child processes that they have received
all input. For this the tt(close) or tt(eoi) member or the tt(eoi) manipulator
can be used. After calling the tt(close) member, the tt(waitForChild) member
should be called as well. This is not necessary if either the tt(eoi) member
or the tt(eoi) manipulator is used.

If tt(waitForChild) is not called (but information sent to the child which
could not be fully processed by the child process in case the child process
terminated as a result of the tt(Process) object going out of scope), then the
operating system issues a tt(Broken pipe) message, indicating that information
in a pipe was lost.

Arguments passed to child processes may be surrounded by double
or single quotes. Arguments surrounded by double quotes have their double
quotes removed, while interpreting any escape-sequences that may have been
used within. Arguments surrounded by single quotes have their single quotes
removed, while accepting their contents as-is. In addition unquoted
escape-sequences may be specified: those escape sequences are evaluated and
replaced by their intended characters (e.g., tt(\100) is converted to tt(@)).

A full command specification may be surrounded by backtics
(tt(`)-characters). These backtick characters are removed by the tt(Process)
object when the command is started.

Child processes may be allowed a limited amount of time (in seconds) to
complete. By default no time limit is imposed upon child processes.

By default the standard input, output and error streams of child processes are
accessed through their tt(Process) parent processes: information inserted into
the tt(Process) object is forwarded to the child process's standard input
stream, information sent by the child process to its standard output stream
can be extracted from its parent tt(Process) object, and information sent by
the child process to its standard error stream may be obtained through
tt(Process's childErrStream) member.

If the parent and child processes have agreed on some communication process,
then information may alternatingly be sent to and received from the child
process through the tt(Process's ostream) and tt(istream)
facilities. Alternatively, unspecified amounts of information written by child
processes may be processed by separate threads (cf. this manual page's
bf(EXAMPLES) section).

includefile(include/namespace)

manpagesection(INHERITS FROM)
    bf(FBB::Fork)(3bobcat) (private), nl()
    bf(FBB:IOStream)(3bobcat)
    bf(FBB:ProcessEnums)

The tt(struct ProcessEnums) defines enumerations and support functions which
are used by several classes. Its enumerations are documented below; there is
no separate bf(ProcessEnums) man-page.

manpagesection(ENUMERATIONS)

    bf(enum ProcessType):nl()

    The bf(enum ProcessType) defines how a child process is started or
located. Its values are specified at constructor-time or through the
tt(setProcessType) member. This enumeration defines the following symbolic
constants:
        itemization(
        itb(NO_PATH)
           The program specified as child process is started as specified,
            without searching the elements of the tt(PATH) environment
            variable.
        itb(USE_PATH)
           The elements of the tt(PATH) environment variable are used when
            locating the program specified as child process.
        itb(USE_SHELL)
           The program specified as child process is called using tt(/bin/sh
            -c). When (output) redirection is used with the specified command
            the tt(IGNORE_COUT IOMode) (and possibly also the tt(IGNORE_CERR
            IOMode)) should be specified.
        )


    bf(enum IOMode):nl()

       Values of the tt(enum IOMode) are used to define which of the child
process's standard streams can be accessed through the tt(Process) object. Its
symbolic constants may be combined using the tt(bit_or) operator. By default
tt(CIN | COUT | CERR) is used (see below).

    The following symbolic constants are available:
        itemization(
        itb(ALL)
           Shortcut for bf(CIN | COUT | CERR).
        itb(CIN)
           Information inserted into the tt(Process) object is forwarded to
            its child process.  If this is not required then tt(CIN) should
            not be specified.
        itb(CERR)
           Information written by the child process to its standard error
            stream is accessible through tt(Process's childErrStream) member.
            If this is not required then tt(CERR) should not be specified.
        itb(COUT)
           Information written by the child process to its standard output
            stream may be directly be extracted from the tt(Process) object,
            or from its tt(childOutStream) member.  If this is not required
            then tt(CERR) should not be specified.
        itb(DIRECT) 
           When starting a child process (see below at the member tt(start))
            the current process (i.e., the program defining the tt(Process)
            object) is replaced by the child process, inheriting the current
            process's standard input and output streams. If this mode is
            specified in combination with any other tt(IOMode) (except for
            tt(STD), see below) an tt(std::invalid_argument) exception is
            thrown.
        itb(IGNORE_CERR)
           Information written by the child process to its standard error
            stream is sent to tt(/dev/null). An tt(std::invalid_argument)
            exception is thrown if this mode is specified in combination with
            bf(DIRECT, CERR) and/or bf(MERGE_COUT_CERR).
        itb(IGNORE_COUT)
           Information written by the child process to its standard output
            stream is sent to tt(/dev/null). An tt(std::invalid_argument)
            exception is thrown if this mode is specified in combination with
            bf(COUT, DIRECT) and/or bf(MERGE_COUT_CERR).
        itb(IGNORE_COUT_CERR)
           Shortcut for tt(IGNORE_CERR | IGNORE_COUT).
        itb(MERGE_COUT_CERR)
           Information extracted from the tt(Process) object is written by the
            child process to its standard output and standard error streams.
            An tt(std::invalid_argument) exception is thrown if this mode is
            specified in combination with bf(COUT, CERR, DIRECT, IGNORE_COUT)
            or tt(IGNORE_CERR).
        itb(NONE)
           The tt(Process) object does not extract information from or insert
            information into the standard streams of its child process. The
            child process reads the same standard input stream and writes the
            same standard output streams as its parent tt(Process)
            object. When this mode is specified in combination with other
            tt(IOMode) values it is silently ignored.  
        )

    bf(enum ChildOutput):nl()
       The tt(ChildOutput) enumeration defines values returned by the
tt(available) member (see below) indicating to which standard stream the
child process has written information.  This enumeration defines the following
values:
        itemization(
        itb(NOTHING_AVAILABLE)
           The child process did not (yet) write any information to its
            standard streams;
        itb(CHILD_COUT)
           The child process wrote information to its standard output
            stream which is waiting for extraction.
        itb(CHILD_CERR)
           The child process wrote information to its standard error stream
            which is waiting for extraction.
        )
    The latter two values may be combined using the tt(bit_or) operator. The
tt(bit_and) operator,returning a tt(bool) value can be used to test whether
information on a specific output stream is available.

manpagesection(PROCESS PARAMETERS)
    
Four process parameters may be specified: the sizes of the stream buffers
which are used when communicating with child processes; to specify which of
the standard streams of child processes can be accessed from the tt(Process)
object combinations of tt(IOMode) values are used; to specify how child
programs are found a tt(ProcessType) value is used; to specify the maximum
time (in seconds) the child program is allowed to run a tt(size_t) values is
used.

By default, the stream buffers hold 200 bytes; all the child's standard
streams (standard input, output and error) are accessible from the tt(Parent)
process; the tt(PATH) environment variable is em(not) used to locate the child
program; and the child processes will be allowed an unlimited amount of time
to run.

After constructing a tt(Process) object all default parameters may be
modified. These parameters may either be altered for a single process or a
tt(Process) object's general defaults may be modified. The tt(set*) members
(see below) may be used to change the default process parameters. When
parameters are specified otherwise, they will only be active for the next
process.

manpagesection(CONSTRUCTORS)

    The command provided to the following constructors may be the
(initial part of the) specification of an external program to run. When the
program is eventually started it may start and end with a em(back-tick)
(tt(`)). The back-ticks will be removed just before the specified program is
executed.

    Child processes are em(not) started automatically following tt(Process)
object constructions. A tt(start) member or the assignment operator (see
below) is used to start the specified child process.

    The tt(mode) parameter that is defined for the second through fourth
constructor is defined as a tt(size_t) for backward compatibility reasons.
Internally, this argument is immediately converted to a tt(Process::IOMode)
value, silently ignoring values which do not represent valid tt(IOMode)
values. Multiple tt(IOMode) values may be combined using the bit-or operator.

    After constructing a tt(Process) object its parameters can be changed
using tt(set)-member functions, function call operators or tt(start) members. 

    itemization(
    itb(Process(std::string const &cmd = ""))
       This constructor is used to specify the (initial part of a) command to
execute from a tt(Process) object. Default values are used for the
process parameters (see section bf(PROCESS PARAMETERS)).

    itb(Process(size_t mode, std::string const &cmd = ""))
        This constructor requires the specification of the object's 
bf(IOMode), and it can be used to specify the (initial part of
a) command to execute from a tt(Process) object. Default values
are used for the remaining process parameters (see section bf(PROCESS
PARAMETERS)). 

    itb(Process(size_t mode, ProcessType type, std::string const &cmd = ""))
        This constructor requires the specification of the object's
bf(IOMode) and tt(ProcessType), and it can be used to specify the (initial
part of a) command to execute from a tt(Process) object.  Default values are
used for the remaining process parameters (see section bf(PROCESS
PARAMETERS)).

    itb(Process(size_t mode, ProcessType type, size_t timeLimit, 
std::string const &cmd = ""))
        This constructor requires the specification of the object's
bf(IOMode), tt(ProcessType), and child process time limit. The (initial part
of a) command to execute from a tt(Process) object may optionally be
specified. The default process parameter is used for the sizes of the
internally used stream buffers (see section bf(PROCESS PARAMETERS)).

    itb(Process(IOMode mode, ProcessType type, size_t timeLimit, size_t
        bufferSize, std::string const &cmd = ""))
        This constructor requires the specification of the object's
bf(IOMode), tt(ProcessType), child process time limit, and size of the
internally used stream buffers. The (initial part of a) command to execute
from a tt(Process) object may optionally be specified. Note that this
constructor's tt(mode) parameter does not accept a tt(size_t) argument.
    )
    The class bf(Process) does not offer copy or move constructors.

manpagesection(OVERLOADED OPERATORS)

    itemization(
    itb(Process &operator<<(Type value))
        This operator inserts tt(value) into the child's standard
input stream. I.e., the child process reads tt(value) from its standard
input. A value of any type that can be inserted into an tt(ostream) can be
inserted into a tt(Process) object. Nothing happens if the member is used when
the child process has terminated. The behavior of this operator is undefined
unless tt(IOMode CIN) was specified.

    itb(Process &operator>>(Type value))
        This operator extracts tt(value) from the child's standard output
stream and optionally (if tt(IOMode MERGE_COUT_CERR) was specified) from the
child's error stream. I.e., tt(value) may be extracted from tt(Process)
objects. A value of any type that can be extracted from an tt(istream)
can be extracted from a tt(Process) object. Nothing happens if the member is
used when the child process has terminated. The behavior of this operator is
undefined unless tt(IOMode COUT) or tt(MERGE_COUT_CERR) was specified.

    itb(Process &operator+=(std::string const &))
       This operator adds the provided tt(std::string) object to the currenly
defined command specification of a tt(Process) object. The member
tt(operator+=) does not add a separating blank space between the currently
stored command specification and the text to append.  It merely adds its
right-hand side string to the command stored so far. It does not affect a
currently running child process.

    itb(int operator=(std::string const &cmd))
       The tt(operator=) member defines tt(cmd) as the  stored command in
a tt(Process) object.  

    Before starting the child process a possibly active child process is first
stopped by calling tt(stop). It returns tt(stop)'s return value.

    itb(Process &operator()(IOMode mode))
        This operator changes the the tt(Process) object's tt(IOMode)
parameter. A reference to the tt(Process) object is returned, allowing
constructions like
        verb(
    process(Process::COUT) = "/bin/cat"; 
        )
    to start a new child process with the specified tt(IOMode). 

    itb(Process &operator()(IOMode mode, ProcessType type))
        This operator changes the tt(Process) object's tt(IOMode) and
tt(ProcessType) process parameters.

    itb(Process &operator()(size_t mode, ProcessType type, size_t timeLimit))
        This operator changes the tt(Process) object's mentioned process
parameters, silently converting the tt(size_t mode) to an tt(IOMode)
value. The currently specified default size of the stream buffers is kept
as-is.

    itb(Process &operator()(IOMode mode, ProcessType type, size_t timeLimit,
        size_t bufferSize))
        This operator changes all of the tt(Process) object's process
parameters.

    itb(Process &operator|(Process &lhs, Process &rhs))
        This operator implements process em(piping): information sent b
tt(lhs) to its standard output becomes the tt(rhs)'s standard input. The
operator returns tt(rhs). 

    This operator mimics the piping-operator supported by most command-shell
programs and should not be confused with the binary-or operator. The operator
starts the tt(lhs)'s  child process, but the tt(rhs)'s child
process (and thus pipe processing) must explicitly be started.

    Since tt(operator|) is left-associative and tt(rhs) is returned piping can
be em(chained), allowing constructions like tt(p1 | p2 | p3), where tt(p1, p2)
and tt(p3) are tt(Process) objects. 

The following idiom can be used to start the execution of a chain of
processes: tt((p1 | p2 | p3).start()). Alternatively, the following two-step
procedure can be used:
        verb(
    p1 | p2 | p3;
    p3.start();
        )

    If tt(p1) specifies tt(Process::CIN) then this tt(IOMode) is forwared to
the final process of the chain of processes. It is not necessary to specify
tt(Process::CIN) for tt(p3). In fact, most tt(IOMode) flags of processes
passed to tt(operator|) are ignored or modified. Acceptable tt(IOModes) are
tt(Process::IGNORE_CERR) and tt(Process::CERR) (accepted for all processes),
tt(Process::CIN) (accepted for the first process of the chain), and
tt(Process::COUT) (for the last process of the chain). After connecting a
series of processes using tt(operator|) all input and output (except for the
standard error streams) is handled through the last process: if
tt(Process::CIN) is specified for the first process then this mode is
transferred to the last process, so information inserted into the last process
enters the pipe through the first process's standard input.

    The next example illustrates how input can be inserted into the first
process from a main process and sent to the standard output stream by the
final process:
        verb(   
    using namespace std;
    using namespace FBB;

    Process p1(Process::CIN, "/bin/cat"); 
    Process p2("/bin/cat");
    Process p3(Process::STD, "/bin/cat");

    p1 | p2 | p3;

    p3.start();

    p3 << cin.rdbuf() << eoi;
        )    
    Note that when specifying multiple commands using the piping operator
(tt('|')), traditionally tt(USE_SHELL) had to be specified, as the traditional
piping operator is a shell-feature. tt(Process's operator|) handles I/O piping
itself, and thus avoids the additional shell process.
    )
    The default overloaded copy and move assignment operators are not
available.

manpagesection(MEMBERS)

    itemization(
    itb(bool active())
        This member returns tt(true) if the child process is currently running
and tt(false) if not.

    itb(size_t available())
        This member returns immediately. Its return value indicates whether
any information can be obtained from the child process as value(s) from the
tt(enum ChildOutput). tt(NOTHING_AVAILABLE) is returned if no information is
ready for extraction. tt(CHILD_COUT) is returned if information from the child
process's standard output stream is available; tt(CHILD_CERR) is returned if
information from the child process's standard error stream is available;
tt(CHILD_COUT | CHILD_CERR) is returned if information from both the standard
output and standard error streams is available. The tt(bit_and) operator,
returning a tt(bool) value, can be used to determine which stream has any
pending information. E.g.,
        verb(
    if (process.available() & Process::CHILD_COUT)
        cout << "Process has child standard output available";
        )

    itb(size_t bufSize() const)
        This member returns the default size of the stream buffers that are
used for communication with child processes. If called while a child process
is actually running, then the value returned by this member may differ from
the value that was actually used when starting the child process, as the
default value may be altered by a function call operator just before starting
the child process.

    itb(std::istream &cerr())
        This member should be avoided. Use tt(childErrStream) instead.nl()

    itb(std::istream &childErrStream())
        If tt(Process::CERR) was specified then this member interfaces
to the child's standard error stream. By extracting the information from
tt(childErrStream) the parent process retrieves the information sent by its
child process to its standard error stream.

    itb(std::istream &childOutStream())
        If tt(Process::COUT) or
tt(Process::MERGE_COUT_CERR) was specified then this member interfaces
to the child's standard output stream. By extracting the information from
tt(childOutStream) the parent process retrieves the information sent by its
child process to its standard output stream. Alternatively, this information
may directly be extracted from the tt(Process) object itself, but this member
does not require the use of a tt(static_cast) to disambiguate the intended
stream buffer in statements like
        verb(
    cout << process.childOutStream().rdbbuf()
        )

    itb(void close())
        This member closes the child's input stream. In situations where the
child continuously reads information from its standard input stream this
member can be used to inform the child process that input has terminated. This
member should only be used when tt(IOMode CIN) was specified for the currently
running child process; otherwise its behavior is undefined. Alternatively, the
tt(eoi) member or manipulator may be used.

    itb(void eoi())
        This member closes the child's input stream, and then calls
tt(waitForChild) to wait for the child process to end. In situations where the
child continuously reads information from its standard input stream this
member can be used to inform the child process that input has terminated. This
member should only be used when tt(IOMode CIN) was specified for the currently
running child process; otherwise its behavior is undefined. Alternatively, the
tt(close) member or tt(eoi) manipulator may be used.

    itb(std::istream &errStream())
        This member may be used to extract information written by the child
process to its standard error stream.  This member should only be used when
tt(IOMode CERR) was specified for the currently running child process;
otherwise its behavior is undefined.nl()

    itb(IOMode ioMode() const)
        This member returns the default tt(IOMode). If called while a child
process is actually running, then the value returned by this member may differ
from the value that was actually used when starting the child process, as the
default value may be altered by a function call operator just before starting
the child process.

    itb(ProcessType processType() const)
        This member returns the default tt(ProcessType) of child proceses. If
called while a child process is actually running, then the value returned by
this member may differ from the value that was actually used when starting the
child process, as the default value may be altered by a function call operator
just before starting the child process.

    itb(size_t timeLimit() const)
        This member returns the default time limit (in seconds) of child
processes. A return value of zero indicates that no time limit is enforced. If
called while a child process is actually running, then the value returned by
this member may differ from the value that was actually used when starting the
child process, as the default value may be altered by a function call operator
just before starting the child process.

    itb(void setBufSize(size_t bufSize))
        This member changes the default stream buffer size that is used for
communication with child processes. A zero byte buffer size is silently
changed into one. The new default value will be used when starting the next
child process.

    itb(void setCommand(std::string const &cmd))
       The tt(setCommand) member (re)defines the (initial part of a) child
process command specification.

    This member does not actually start the child process, and tt(operator+=)
may be used to append additional text to the command specification. Also, this
member may be used when a child process is currently active: its use does not
affect a currently running child process.

    itb(void setIOMode(iomode mode))
        This member changes the default tt(IOMode). The new default value will
be used when starting the next child process.

    itb(void setProcessType(ProcessType type))
        This member changes the default tt(ProcessType). The new default value
will be used when starting the next child process.

    itb(void setTimeLimit(size_t timeLimit))
        This member changes the default execution time limit (in seconds). No
time limit will be imposed upon child processes if tt(timeLimit 0) is
specified. The new default value will be used when starting the next child
process.

    itb(void start())
        The currently specified command is started using the tt(Process)
object's process parameters. 

    Having specified a command to start, the first white-space delimited
element of the specified command is used as the name of the program to
start. If the program should be called through bf(sh)(1), the tt(USE_SHELL
ProcessType) or a tt(system) member should be used.

    If a child process does not terminate by itself, then it is terminated
when it has run for its alloted time; when the tt(Process) object's tt(start)
or tt(stop) members are called; when the object's assignment operator is used;
or when the object goes out of scope.

    itb(void start(IOMode mode))
       The currently specified command is started using the specified
tt(IOMode), but otherwise using the currently configured tt(Process) object's
process parameters. The specified tt(IOMode) is only used for the child
process that is started by this member.

    itb(void start(IOMode mode, ProcessType type))
       The currently specified command is started using the specified
tt(IOMode) and tt(ProcessType), but otherwise using the currently configured
tt(Process) object's process parameters. The specified process parameter
values are only used for the child process that is started by this member.

    itb(void start(size_t mode, Program program, size_t timeLimit))
       The currently specified command is started using the specified
tt(IOMode), tt(ProcessType), and time limit (silently converting the tt(size_t
mode) to an tt(IOMode) value), and using the currently configured tt(Process)
object's stream buffer size parameter. The specified process parameter values
are only used for the child process that is started by this member.

    itb(void start(IOMode mode, Program program, size_t timeLimit, size_t
        bufferSize)) 
       The currently specified command is started using the specified process
parameters. The specified parameter values are only used for the child process
that is started by this member.

    itb(void showMode(char const *lab) const)
        This member displays the label tt(lab), followed by the current
process ID, followed by the child process's process ID, followed by a textual
representation of the currently active tt(IOMode).

    itb(std::string const &str() const)
        This member returns the contents of the current child process command
specification. It shows the command as it will be (or has been) executed by
tt(start), tt(system) or the assignment operator. 

    itb(void system())
        This member executes the currently stored command as a command to
bf(sh)(1).  When using tt(system) redirections can be included in the command
itself (this renders the redirected streams implied by the current bf(IOMode))
useless. The currently set process parameters are used when bf(sh)(1) is
executed.

    itb(void system(IOMode mode))
        This member executes the currently stored command as a command to
bf(sh)(1) (cf. tt(system) above) using the specified tt(IOMode) rather than
the current default tt(IOMode) setting.

    itb(void system(IOMode mode, size_t timeLimit))
        This member executes the currently stored command as a command to
bf(sh)(1) (cf. tt(system) above) using the specified tt(IOMode) and time
limit.

    itb(void system(IOMode mode, size_t timeLimit, size_t bufSize))
        This member executes the currently stored command as a command to
bf(sh)(1) (cf. tt(system) above) using the specified tt(IOMode), time
limit, and stream buffer size values.

    itb(int stop())
       This member terminates a currently active child process. The child
process is twice sent a tt(SIG_TERM) signal, followed by a tt(SIG_KILL)
signal. This member returns the exit-value of the child process that was
stopped. Its operation and return value are undefined if called without a
running child process.

    Following tt(stop) a new command may be called using tt(start, system) or
the assignment operator (see earlier). Those members first calls tt(stop).
When the intention is to start another child process, then there's no need to
call tt(stop) explicitly. Also, tt(stop) is called when the tt(Process) object
goes out of scope.

    itb(int waitForChild())
        This member is inherited from the class tt(FBB::Fork). It waits for a
child process to end. It is called to prevent premature termination of a
child process before calling tt(stop). It is not always necessary to call
tt(waitForChild). E.g., when a process writes to its standard output stream
and all output has been read then the child process can be stopped without
calling tt(waitForChild).
    )

manpagesection(MANIPULATOR)
    itemization(
    itb(FBB::eoi)
        This manipulator may be inserted into a tt(Process) object for which
tt(IOMode CIN) was specified. It closes the child's input stream, and then
calls tt(waitForChild) to wait for the child process to end. In situations
where the child continuously reads information from its standard input stream
this member can be used to inform the child process that input has
terminated. Alternatively, tt(Process) object's tt(close) or tt(eoi) members
may be used.
    )

manpagesection(EXAMPLES)

    The first example shows how a program only producing output can be
called. Its child process simply is tt(/bin/ls):
        verbinsert(CODE)(../../process/driver/ls.cc)

    The next example shows how a child program can be given a limited amount
of execution time: lines entered at the keyboard are echoed to the standard
output stream for at most 5 seconds:
        verbinsert(CODE)(../../process/driver/limit.cc)

    The final example shows how multi threading can be used to access the
child program's standard output and standard error streams through the
tt(Process) object:
        verbinsert(CODE)(../../process/driver/all.cc)

    Additional examples are found in the distribution's
tt(bobcat/process/driver) directory. 

manpagefiles()
    em(bobcat/process) - defines the class interface

manpageseealso()
    bf(bobcat)(7), bf(execle)(3), bf(fork)(3bobcat), bf(iostream)(3fork),
    bf(sh)(1)

manpagebugs()
    With the release of Bobcat 1.21.1 the class tt(Process) was completely
rewritten. The new implementation, however, should not affect existing
programs other than that tt(Process) will no longer impose a limited
time-to-live upon child processes. The interface was enlarged, but this should
not affect existing programs. The internal organization of the tt(Process)
class em(has) changed though, requiring recompilation of sources defining
tt(Process) class type objects and linking dynamically to the tt(Bobcat)
library. 

    With the release of Bobcat 2.11.0 another major modification of
tt(Process) was realized. Although tt(Process)'s internal organization was
again modified this does not affect exeisting programs using tt(Process)
objects. No recompilation of existing sources using tt(Process) is required.

includefile(include/trailer)


