From 034cd404a129103a8dd7747e6bd00ffd5550da93 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Mon, 30 Jun 2025 07:51:23 +0100 Subject: refactoring --- nihil.posix/execshell.ccm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 nihil.posix/execshell.ccm (limited to 'nihil.posix/execshell.ccm') diff --git a/nihil.posix/execshell.ccm b/nihil.posix/execshell.ccm new file mode 100644 index 0000000..1fbfccf --- /dev/null +++ b/nihil.posix/execshell.ccm @@ -0,0 +1,21 @@ +// This source code is released into the public domain. +module; + +#include + +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 -- cgit v1.2.3