aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.posix/execvp.cc
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-06-30 07:51:23 +0100
committerLexi Winter <lexi@le-fay.org>2025-06-30 07:51:23 +0100
commit034cd404a129103a8dd7747e6bd00ffd5550da93 (patch)
treed27946517d4d9333abd26ac50bbd4a436093e2ce /nihil.posix/execvp.cc
parent3e7902f7d790a486d3d9cb978df193f07f3a6ad9 (diff)
downloadnihil-034cd404a129103a8dd7747e6bd00ffd5550da93.tar.gz
nihil-034cd404a129103a8dd7747e6bd00ffd5550da93.tar.bz2
refactoring
Diffstat (limited to 'nihil.posix/execvp.cc')
-rw-r--r--nihil.posix/execvp.cc50
1 files changed, 0 insertions, 50 deletions
diff --git a/nihil.posix/execvp.cc b/nihil.posix/execvp.cc
deleted file mode 100644
index 5eac315..0000000
--- a/nihil.posix/execvp.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This source code is released into the public domain.
- */
-
-module;
-
-#include <coroutine>
-#include <expected>
-#include <filesystem>
-#include <format>
-#include <string>
-#include <utility>
-
-#include <err.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "nihil.hh"
-
-module nihil.posix;
-
-import nihil.error;
-import nihil.monad;
-
-namespace nihil {
-#ifdef NIHIL_HAVE_FEXECVE
-
-auto execvp(std::string_view file, argv &&argv) -> std::expected<fexecv, error>
-{
- auto execfd = open_in_path(file);
- if (!execfd)
- return std::unexpected(error(
- std::format("executable not found in path: {}", file)));
- return fexecv(std::move(*execfd), std::move(argv));
-}
-
-#else // !NIHIL_HAVE_FEXECVE
-
-auto execvp(std::string_view file, nihil::argv &&argv) -> std::expected<nihil::execv, nihil::error>
-{
- auto filename = nihil::find_in_path(file);
- if (!filename)
- return std::unexpected(nihil::error(
- std::format("executable not found in path: {}", file)));
- return execv(std::move(*filename), std::move(argv));
-}
-
-#endif // NIHIL_HAVE_FEXECVE
-
-} // namespace nihil