StormByte C++ Library: System module 1.0.1.9999
StormByte-System is the C++26 process and environment module of the StormByte suite.
Loading...
Searching...
No Matches
StormByte-System

Multiplatform C++26 CMake License: LGPL v3 CI Sponsor

StormByte-System is the C++26 system module of the StormByte suite.

Spawn processes with piped stdin/stdout/stderr, chain them, suspend/resume, and expand environment variables. POSIX and Windows stay behind one API.

Table of Contents

  • Repository
  • Installation
  • Why StormByte-System
  • Features
  • Dependencies
  • The rest of the suite
  • Public API
  • Examples
    • Run a process
    • Pipe two processes
    • Expand variables
  • Design notes
  • Testing
  • Contributing
  • License

Repository

Installation

git clone https://github.com/StormBytePP/StormByte-System.git
cd StormByte-System
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
cmake --install build

Why StormByte-System

Goal How it is achieved
One process API Process starts on construct; pipes are private.
Shell-like chaining p1 >> p2 forwards stdout to stdin on a worker thread.
stdin control << writes; << System::EoF closes the write end.
Environment paths Variable::Expand (VAR% on Windows, ~ on UNIX).

Features

  • Move-only Process (fork/exec or CreateProcess)
  • Piped stdin, stdout, stderr
  • Wait, Pid, Suspend, Resume
  • Process chaining
  • FileIOError, ExecutableNotFound
  • Private Pipe (pipe2 / CreatePipe)

Dependencies

Dependency Role
StormByte (base) Exceptions, visibility

The rest of the suite

Module Role API
Base Exceptions, Expected, serialization, strings, UUID, concepts /StormByte
Buffer FIFO, SharedFIFO, Ring, Producer/Consumer and multi-stage pipelines /StormByte-Buffer
Config Human-readable text and versioned binary documents (groups, lists, raw bytes) /StormByte-Config
Crypto Hash, compress, encrypt, sign and key agreement — Crypto++ never leaves the private tree /StormByte-Crypto
Database One API over SQLite, PostgreSQL and MariaDB /StormByte-Database
Logger Stream logger with levels, headers, human-readable sizes and redaction (ThreadedLog) /StormByte-Logger
Multimedia Decode, encode and containers without raw FFmpeg types; codecs enabled only if present /StormByte-Multimedia
Network Framed packets, Client/Server, IPv4/IPv6 TCP and Buffer pipelines (compress/encrypt) /StormByte-Network
System This repository /StormByte-System

Public API

Type Role
Process Spawn and talk to a child
Variable Expand environment strings
Exception / FileIOError / ExecutableNotFound Errors
System::EoF Close process stdin

Pipe is private.

Examples

Run a process

#include <StormByte/system/process.hxx>
StormByte::System::Process echo("/bin/echo", {"hello"});
std::string out;
echo >> out;
echo.Wait();
Runs an external program with piped stdin/stdout/stderr.
Definition process.hxx:60
DWORD Wait() noexcept
Block until the process exits (no timeout).

Pipe two processes

StormByte::System::Process producer("/bin/echo", {"hello"});
StormByte::System::Process consumer("/usr/bin/tr", {"a-z", "A-Z"});
producer >> consumer;
producer << StormByte::System::EoF;
std::string out;
consumer >> out;

On Windows use C:\\Windows\\System32\\cmd.exe (or the real binary path) instead of /bin/echo.

Expand variables

#include <StormByte/system/variable.hxx>
#ifdef WINDOWS
#endif
static std::string Expand(const std::string &str)
Expand environment variables in str.

Design notes

  • Construction starts the child immediately.
  • Wait() has no timeout.
  • Destructor waits if the process is still owned.
  • Move invalidates the source (PID / handles cleared).

Testing

Enable tests in CMake (ENABLE_TEST) and run CTest from the build tree.

Contributing

Issues on GitHub. No wiki, no discussions.

License

GNU Lesser General Public License v3 or later.

See https://www.gnu.org/licenses/lgpl-3.0.html.