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

import nihil.std;
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