1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
includefile(include/header)
COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::CoutExtractor)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_)
(Executing Child Processes)
manpagename(FBB::CoutExtractor)(Runs external programs writing standard output)
manpagesynopsis()
bf(#include <bobcat/coutextractor>)nl()
Linking option: tt(-lbobcat)
manpagedescription()
The bf(FBB::CoutExtractor) class offers a basic interface for calling
external programs (so-called em(child processes)) writing their standard
output streams. The standard input and standard error streams of the child
processes by default are not handled by tt(CoutExtractor) objects. The child's
standard output is read through the tt(CoutExtractor) object: information
written by the child process to its standard output stream is extracted or
read from tt(CoutExtractor) object. The tt(PATH) environment variable is not
used when calling child processes: child process programs must be specified
using paths.
tt(CoutExtractor) objects may repeatedly be used to execute the same or
different child processes.
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 content 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(@)).
includefile(include/namespace)
manpagesection(INHERITS FROM)
bf(FBB::Exec) (private),
bf(FBB::IFdBuf) (private),
bf(std::istream)
manpagesection(CONSTRUCTOR)
itemization(
itb(CoutExtractor(size_t bufSize = 100))
A tt(bufSize) argument may be specified: it defines the internal buffer
size used by the tt(CoutExtractor's) streambuf. By default the
stdandard input and standard error streams are not handled.
itb(CoutExtractor(Mode mode, size_t bufSize = 100))
The tt(mode) argument must be tt(CoutExtractor::CLOSE_STD). It
indicates that the standard input and standard error streams are
redirected to tt(/dev/null): the child processes cannot read their
standard input streams and any standard error output generated by
child processes is ignored. A tt(bufSize) argument may be specified:
it defines the internal buffer size used by the tt(CinInserter's)
streambuf.
)
Copy and move constructors (and assignment operators) are not available.
manpagesection(MEMBERS)
itemization(
itb(void execute(std::string const &cmd))
The argument specifies the command to execute: the command itself must
be specified as a path (the tt(PATH) environment variable isn't used).
This member immediately returns, after which information written by
the child process to its standard output stream may be extracted from
the tt(CoutExtractor) object.
Once tt(execute) has returned it can be called again, either using the
same or another command.
Arguments passed to the program to be executed as child process may
optionally be specified using single or double quotes, as described in
this man-page's DESCRIPTION section.
itb(int ret() const)
Once tt(execute) has returned this member provides the actual exit
code of the child process. Its value equals -1 before the first tt(exectue)
call.
)
manpagesection(PROTECTED MEMBER)
itemization(
itb(Pipe &childOutPipe())
If derived classes need to override the redirections-members then they
probabaly need access to the pipe written by the child process. This
member provides a reference to that pipe. By default the parent
process reads information from the pipe, while the child process
inserts its standard output into the pipe.
)
manpagesection(EXAMPLE)
verbinclude(../../coutextractor/driver/driver.cc)
manpagefiles()
em(bobcat/coutextractor) - provides the class interface
manpageseealso()
bf(bobcat)(7), bf(cerrextractor)(3bobcat), bf(cininserter)(3bobcat),
bf(execl)(3), bf(exec)(3bobcat),
bf(fork)(3bobcat), bf(process)(3bobcat), bf(stdextractor)(3bobcat).
manpagebugs()
None reported.
includefile(include/trailer)
|