NoTeX 1.0.0
A modern noteworthy LaTeX template
Loading...
Searching...
No Matches
notex::system Namespace Reference

Functions

std::string run_command (const std::string &command)
 Runs command through the shell and returns everything it wrote to standard output (and standard error, since the two are merged so that a failing command's diagnostics end up in the error message below).
std::optional< std::string > get_env (const std::string &name)
 Reads an environment variable.

Detailed Description

NoTeX Copyright (c) 2026 Marco Tallone Licensed under the MIT License. See LICENCE for details.

Implements notex::system, wrapping ::popen/::pclose and std::getenv.

Function Documentation

◆ get_env()

std::optional< std::string > notex::system::get_env ( const std::string & name)

Reads an environment variable.

Parameters
nameName of the environment variable to read.
Returns
Its value, or std::nullopt if it is not set.

Definition at line 52 of file system.cpp.

◆ run_command()

std::string notex::system::run_command ( const std::string & command)

Runs command through the shell and returns everything it wrote to standard output (and standard error, since the two are merged so that a failing command's diagnostics end up in the error message below).

Parameters
commandShell command line to execute.
Returns
The command's captured output, with any trailing newline removed.
Exceptions
NotexErrorif the command could not be started, or exited with a non-zero status. Callers that expect failure to be routine (for example, a database-refresh tool that may be absent) are expected to catch this and downgrade it rather than propagate it.

Definition at line 19 of file system.cpp.

References notex::FAILURE.

Referenced by notex::Installer::install_global(), and notex::Installer::uninstall_global().