blob: d4c090dfe0e8b2ef1a46c1237fd66286bac3f0d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/*
* This source code is released into the public domain.
*/
module;
#include <filesystem>
#include <optional>
export module nihil.posix:open_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
|