blob: f3cbf9ae59cb7ea784fbeb849e586bd25140a4d8 (
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
40
|
/*
* This source code is released into the public domain.
*/
module;
#include <expected>
#include <string>
#include "nihil.hh"
export module nihil.posix:execl;
import nihil.error;
import :argv;
import :execv;
import :fexecv;
namespace nihil {
/*
* execl: equivalent to (f)execv, except the arguments are passed as a
* variadic pack of string-like objects.
*/
export [[nodiscard]] auto execl(std::string_view path, auto &&...args) -> execv
{
return execv(path, argv({std::string_view(args)...}));
}
#ifdef NIHIL_HAVE_FEXECVE
export [[nodiscard]] auto execl(fd &&executable, auto &&...args) -> fexecv
{
return fexecv(std::move(executable), argv({std::string_view(args)...}));
}
#endif // NIHIL_HAVE_FEXECVE
} // namespace nihil
|