FBB::Ce...tractor(3bobcat)

okay so bestie πŸ’– welcome to FBB::CerrExtractor, straight out of the 3bobcat manual, where we execute child processes and read everything they scream into standard error. It's giving "middle management for fork/exec" and honestly? iconic. Sit down, grab a πŸ“, let's go.


✨ NAME ✨

FBB::CerrExtractor β€” runs external programs writing standard error. 🫢


✨ SYNOPSIS ✨

#include <bobcat/cerrextractor>

Linking option: -lbobcat πŸ”—


🌈 DESCRIPTION 🌈

Okay so the FBB::CerrExtractor class is a basic interface for calling external programs (aka child processes) that write to their standard error streams. Think of it as your lil handler for the chaotic stderr energy. πŸ’…

By default, the child process's standard input and standard output streams are not handled by CerrExtractor objects. No cap. The child's standard error is what gets read through the CerrExtractor object: anything the child process writes to its standard error stream is extracted or read from that CerrExtractor object. That's the whole job. 🌸

⚠️ Big one: the PATH environment variable is not used when calling child processes. Child process programs have to be specified using paths. Yes, actual paths. The vibes do not locate your binary for you, bestie.

CerrExtractor objects may repeatedly be used to execute the same or different child processes β€” reuse era, we love a sustainable queen. ♻️

Now, the quoting rules, because this is where it gets ✨spicy✨:

  • 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., \100 is converted to @). 😭 yes literally.

πŸŽ€ NAMESPACE πŸŽ€

FBB

All constructors, members, operators and manipulators mentioned in this man-page are defined in the namespace FBB.


πŸ¦‹ INHERITS FROM πŸ¦‹

FBB::Exec (private), FBB::IFdBuf (private), std::istream

Three parents, one slay. πŸ‘‘


⭐ CONSTRUCTOR ⭐

  • CerrExtractor(size_t bufSize = 100) β€” you may pass a bufSize argument: it defines the internal buffer size used by the CerrExtractor's streambuf. By default the standard input and standard output streams are not handled. πŸ’–
  • CerrExtractor(Mode mode, size_t bufSize = 100) β€” the mode argument must be CerrExtractor::CLOSE_STD. It indicates that the standard input and standard error streams are redirected to /dev/null: the child processes cannot read their standard input streams and any standard output generated by child processes is ignored. A bufSize argument may be specified: it defines the internal buffer size used by the CinInserter's streambuf. 🫧
🚨 Copy and move constructors (and assignment operators) are not available. Not negotiable, not coming back, no notes.

πŸ’œ MEMBERS πŸ’œ

  • void execute(std::string const &cmd) β€” the argument specifies the command to execute: the command itself must be specified using an absolute path (the PATH environment variable isn't used, reminder bestie πŸ’€). This member immediately returns, after which information written by the child process to its standard error stream may be extracted from the CerrExtractor object.

Once execute has returned it can be called again, either using the same or another command. Repeat offender behavior, but make it productive. ✨

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. πŸ“

  • int ret() const β€” once execute has returned, this member provides the actual exit code of the child process. Its value equals -1 before the first exectue call. (Yes, that's the spelling in the original, and no, we don't edit the original, we respect it. πŸ™ˆ)

🌟 PROTECTED MEMBER 🌟

  • 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 error output into the pipe. πŸ”§

🧚 EXAMPLE 🧚

#include <iostream>

#include <bobcat/cerrextractor>

using namespace std;
using namespace FBB;

int main()
{
    CerrExtractor extractor;

    extractor.execute("/bin/cat driver.cc");

    cout << extractor.rdbuf();

    cerr << "Returning: " << extractor.ret() << "\n"
            "again:\n";

    extractor.execute("/bin/cat driver.cc");

    cout << extractor.rdbuf();

    cerr << "Returning: " << extractor.ret() << ’\n’;

}

πŸ“ FILES πŸ“

  • bobcat/cerrextractor β€” provides the class interface

πŸ‘‘ SEE ALSO πŸ‘‘

bobcat(7), cininserter(3bobcat), coutextractor(3bobcat), execl(3), exec(3bobcat), fork(3bobcat), process(3bobcat), stdextractor(3bobcat).

Go read the whole friend group, they're all connected. 🫢


πŸ’€ BUGS πŸ’€

None reported.


🌸 BOBCAT PROJECT FILES 🌸

Debian Bobcat project files:

  • libbobcat6 β€” debian package containing the shared library, changelog and copyright note;
  • libbobcat-dev β€” debian package containing the static library, headers, manual pages, and developer info;

πŸŽ€ BOBCAT πŸŽ€

Bobcat is an acronym of Brokken’s Own Base Classes And Templates. 🐱 the lore is real


This is free software, distributed under the terms of the GNU General Public License (GPL). Free as in freedom, and free as in slay. 🌈


πŸ¦‹ AUTHOR πŸ¦‹

Frank B. Brokken (f.b.brokken@rug.nl).


and that's the whole page bestie, no cap, we kept every single flag, path, exit code and footnote. ate and left no crumbs. πŸ’–

signing off from libbobcat-dev_6.15.01 β€” copyright vibes spanning 2005-2026, FBB::Ce...tractor(3bobcat), the one and only. mwah πŸ’‹

πŸ“¦ where this page comes from