aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.posix/posix.ccm
blob: e63ad6b1cfb1c4b49b9735b21588ea4da2020a3d (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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * This source code is released into the public domain.
 */

module;

#include <expected>
#include <filesystem>
#include <optional>
#include <string>

export module nihil.posix;

import nihil.error;

export import :argv;
export import :ensure_dir;
export import :exec;
export import :fd;
export import :getenv;
export import :open;
export import :process;
export import :read_file;
export import :rename;
export import :spawn;
export import :tempfile;
export import :write_file;

export namespace nihil {

/*
 * Find an executable in $PATH, open it with O_EXEC and return the fd.
 * If $PATH is not set, uses _PATH_DEFPATH.  If the file can't be found
 * or opened, returns std::nullopt.
 */
[[nodiscard]] auto find_in_path(std::filesystem::path const &file)
	-> std::optional<fd>;

} // namespace nihil