|
BuildCache
|
System utility functions. More...
Classes | |
| struct | run_result_t |
| Run results from an external command. More... | |
Functions | |
| run_result_t | run (const string_list_t &args, const bool quiet=true, const std::string &work_dir=std::string()) |
| Run the given command. More... | |
| run_result_t | run_with_prefix (const string_list_t &args, const bool quiet=true, const std::string &work_dir=std::string()) |
| Run the given command with an optional prefix. More... | |
| void | open_in_default_editor (const std::string &path) |
| Open a file in the user default editor. More... | |
| void | print_raw_stdout (const std::string &str) |
| Print a string to stdout. More... | |
| void | print_raw_stderr (const std::string &str) |
| Print a string to stderr. More... | |
| std::string | get_local_temp_folder () |
| Get the temporary folder for this BuildCache instance. More... | |
System utility functions.
| std::string bcache::sys::get_local_temp_folder | ( | ) |
Get the temporary folder for this BuildCache instance.
The temporary folder is located somewhere under $BUILDCACHE_DIR, and as such is suitable for files that later need to be moved or linked inside the local cache structure (for instance). The folder can also be considered a separate namespace that is dedicated to BuildCache, which means that it is very unlikely that there will be any file name conflicts with other programs.
| void bcache::sys::open_in_default_editor | ( | const std::string & | path | ) |
Open a file in the user default editor.
| path | Path to the file to edit. |
| void bcache::sys::print_raw_stderr | ( | const std::string & | str | ) |
Print a string to stderr.
Unlike using standard C++ methods, such as writing to std::cerr, this function sends the string to stderr without any text mode translations (such as LF -> CRLF). This is useful for correctly reproducing program output 1:1 (especially important on Windows).
| str | The string to be printed. |
| runtime_error | if the string could not be printed. |
| void bcache::sys::print_raw_stdout | ( | const std::string & | str | ) |
Print a string to stdout.
Unlike using standard C++ methods, such as writing to std::cout, this function sends the string to stdout without any text mode translations (such as LF -> CRLF). This is useful for correctly reproducing program output 1:1 (especially important on Windows).
| str | The string to be printed. |
| runtime_error | if the string could not be printed. |
| run_result_t bcache::sys::run | ( | const string_list_t & | args, |
| const bool | quiet = true, |
||
| const std::string & | work_dir = std::string() |
||
| ) |
Run the given command.
| args | The command and its arguments (the first item is the command). |
| quiet | Supress output to stdout/stderr during execution. |
| work_dir | Set the CWD during the execution of the command. |
| runtime_error | if the command could not be run. |
| run_result_t bcache::sys::run_with_prefix | ( | const string_list_t & | args, |
| const bool | quiet = true, |
||
| const std::string & | work_dir = std::string() |
||
| ) |
Run the given command with an optional prefix.
Unlike the run() function, this function will optinally use a prefix (wrapper) as specified by the environment variable BUILDCACHE_PREFIX.
| args | The command and its arguments (the first item is the command). |
| quiet | Supress output to stdout/stderr during execution. |
| work_dir | Set the CWD during the execution of the command. |
| runtime_error | if the command could not be run. |
1.8.17