From 36427c0966faa7aecd586b397ed9b845f18172f5 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Mon, 30 Jun 2025 09:10:16 +0100 Subject: more refactoring; add stat() --- nihil.posix/execlp.test.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'nihil.posix/execlp.test.cc') diff --git a/nihil.posix/execlp.test.cc b/nihil.posix/execlp.test.cc index cedf871..aa32253 100644 --- a/nihil.posix/execlp.test.cc +++ b/nihil.posix/execlp.test.cc @@ -64,4 +64,18 @@ SCENARIO("nihil::execlp() returns the shell's exit code") } } +SCENARIO("nihil::execlp() returns an error if the executable is not in $PATH") +{ + GIVEN("An execlp object for a non-existent executable") + { + auto exec = nihil::execlp("nihil_no_such_executable", "x"); + + THEN("A no_such_file_or_directory error is returned") + { + REQUIRE(!exec); + REQUIRE(exec.error().root_cause() == std::errc::no_such_file_or_directory); + } + } +} + } // anonymous namespace -- cgit v1.2.3