aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.posix/execshell.ccm
blob: 1fbfccf597bffb4b62b26191714b2a2658dcf7a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// This source code is released into the public domain.
module;

#include <string>

export module nihil.posix:execshell;

import nihil.error;
import :execv;
import :execl;

namespace nihil {

// execshell: a spawn executor which runs the process by invoking /bin/sh -c with the
// single argument, equivalent to system(3).
export [[nodiscard]] auto execshell(std::string_view command) -> execv
{
	return execl("/bin/sh", "sh", "-c", command);
}

} // namespace nihil