diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-06-29 19:19:23 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-06-29 19:19:23 +0100 |
| commit | a8b0ea58e60bb0326b7f7c8f3c736d89ce9ef1df (patch) | |
| tree | 6dafcf2674780649dcdc2649855722357837a68e /nihil.posix/open_in_path.ccm | |
| parent | 4fa6821e0645ff61a9380cd090abff472205c630 (diff) | |
| download | nihil-a8b0ea58e60bb0326b7f7c8f3c736d89ce9ef1df.tar.gz nihil-a8b0ea58e60bb0326b7f7c8f3c736d89ce9ef1df.tar.bz2 | |
wip macOS port
Diffstat (limited to 'nihil.posix/open_in_path.ccm')
| -rw-r--r-- | nihil.posix/open_in_path.ccm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/nihil.posix/open_in_path.ccm b/nihil.posix/open_in_path.ccm new file mode 100644 index 0000000..1fae56b --- /dev/null +++ b/nihil.posix/open_in_path.ccm @@ -0,0 +1,23 @@ +/* + * This source code is released into the public domain. + */ + +module; + +#include <filesystem> +#include <optional> + +export module nihil.posix:find_in_path; + +import nihil.error; +import :fd; + +namespace nihil { + +/* + * Find an executable in $PATH and open it with O_EXEC. If $PATH is not set, uses _PATH_DEFPATH. + * If the file can't be found or opened, returns std::nullopt. + */ +export [[nodiscard]] auto open_in_path(std::filesystem::path const &file) -> std::optional<fd>; + +} // namespace nihil |
