1#ifndef SOURCEMETA_CORE_PROCESS_ERROR_H_
2#define SOURCEMETA_CORE_PROCESS_ERROR_H_
4#ifndef SOURCEMETA_CORE_PROCESS_EXPORT
5#include <sourcemeta/core/process_export.h>
8#include <sourcemeta/core/error.h>
10#include <initializer_list>
16namespace sourcemeta::core {
18SOURCEMETA_CORE_ERROR_WARNINGS_PUSH
27 :
Error{
"Could not locate the requested program"}, program_{
program} {}
30 [[nodiscard]]
auto program() const noexcept -> std::string_view {
31 return this->program_;
44 std::initializer_list<std::string_view>
arguments)
45 :
Error{
"Process terminated abnormally"}, program_{
program},
50 std::span<const std::string_view>
arguments)
51 :
Error{
"Process terminated abnormally"}, program_{
program},
55 [[nodiscard]]
auto program() const noexcept -> std::string_view {
56 return this->program_;
61 -> const std::vector<std::
string> & {
62 return this->arguments_;
67 std::vector<std::string> arguments_;
70SOURCEMETA_CORE_ERROR_WARNINGS_POP
Error(const StaticString message) noexcept
Construct the error given its message.
Definition error_base.h:84
ProcessSpawnError(const std::string_view program, std::span< const std::string_view > arguments)
Construct the error given the offending program and its arguments.
Definition process_error.h:49
auto arguments() const noexcept -> const std::vector< std::string > &
The arguments the program was spawned with.
Definition process_error.h:60
auto program() const noexcept -> std::string_view
The offending program.
Definition process_error.h:30
ProcessProgramNotFoundError(const std::string_view program)
Construct the error given the offending program.
Definition process_error.h:26
ProcessSpawnError(const std::string_view program, std::initializer_list< std::string_view > arguments)
Construct the error given the offending program and its arguments.
Definition process_error.h:43
auto program() const noexcept -> std::string_view
The offending program.
Definition process_error.h:55