diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-06-29 20:29:50 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-06-29 20:29:50 +0100 |
| commit | 3e7902f7d790a486d3d9cb978df193f07f3a6ad9 (patch) | |
| tree | fd9815cf214daeec1cad826e040cf8a0cbb6be33 /nihil.posix/execlp.ccm | |
| parent | 67b2fae1fa8b033045a44c1355d9dfd8f83e0d9b (diff) | |
| download | nihil-3e7902f7d790a486d3d9cb978df193f07f3a6ad9.tar.gz nihil-3e7902f7d790a486d3d9cb978df193f07f3a6ad9.tar.bz2 | |
finish macOS support
Diffstat (limited to 'nihil.posix/execlp.ccm')
| -rw-r--r-- | nihil.posix/execlp.ccm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/nihil.posix/execlp.ccm b/nihil.posix/execlp.ccm new file mode 100644 index 0000000..d0d88d5 --- /dev/null +++ b/nihil.posix/execlp.ccm @@ -0,0 +1,30 @@ +/* + * This source code is released into the public domain. + */ + +module; + +#include <string> +#include <expected> +#include <format> + +export module nihil.posix:execlp; + +import nihil.error; +import :exec; +import :argv; +import :execvp; + +namespace nihil { + +/* + * execlp: equivalent to execvp, except the arguments are passed as a + * variadic pack of string-like objects. + */ +export [[nodiscard]] auto execlp(std::string_view file, auto &&...args) + -> std::expected<base_executor_type, error> +{ + return execvp(file, argv({std::string_view(args)...})); +} + +} // namespace nihil |
