aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.posix
diff options
context:
space:
mode:
Diffstat (limited to 'nihil.posix')
-rw-r--r--nihil.posix/posix.spawn.ccm7
-rw-r--r--nihil.posix/posix.tempfile.cc17
-rw-r--r--nihil.posix/posix.tempfile.ccm8
-rw-r--r--nihil.posix/test.fd.cc6
4 files changed, 11 insertions, 27 deletions
diff --git a/nihil.posix/posix.spawn.ccm b/nihil.posix/posix.spawn.ccm
index 5812716..4cce334 100644
--- a/nihil.posix/posix.spawn.ccm
+++ b/nihil.posix/posix.spawn.ccm
@@ -229,12 +229,9 @@ spawn(executor auto &&executor, auto &&...actions)
auto proc = process(pid);
if (pid == 0) {
- // We are in the child. Release the process so we don't
- // try to wait for ourselves, then run child handlers and
- // exec the process.
-
- std::ignore = std::move(proc).release();
+ // We are in the child.
(actions.run_in_child(proc), ...);
+ std::ignore = std::move(proc).release();
auto err = executor.exec();
std::print("{}\n", err.error());
diff --git a/nihil.posix/posix.tempfile.cc b/nihil.posix/posix.tempfile.cc
index 801aa5e..b1d3dee 100644
--- a/nihil.posix/posix.tempfile.cc
+++ b/nihil.posix/posix.tempfile.cc
@@ -40,22 +40,7 @@ temporary_file::temporary_file(temporary_file &&other) noexcept
{
}
-auto temporary_file::operator=(this temporary_file &self,
- temporary_file &&other)
- noexcept -> temporary_file &
-{
- if (&self != &other) {
- if (self.m_fd)
- self.release();
-
- self.m_fd = std::move(other.m_fd);
- self.m_path = std::move(other.m_path);
- }
-
- return self;
-}
-
-temporary_file::~temporary_file()
+temporary_file::~temporary_file() //NOLINT(bugprone-exception-escape)
{
if (m_fd)
release();
diff --git a/nihil.posix/posix.tempfile.ccm b/nihil.posix/posix.tempfile.ccm
index 20378b5..82f3be4 100644
--- a/nihil.posix/posix.tempfile.ccm
+++ b/nihil.posix/posix.tempfile.ccm
@@ -56,13 +56,15 @@ export struct temporary_file final {
// Not copyable.
temporary_file(temporary_file const &) = delete;
- auto operator=(this temporary_file &, temporary_file const &)
- -> temporary_file & = delete;
// Movable.
temporary_file(temporary_file &&other) noexcept;
+
+ // Not assignable.
+ auto operator=(this temporary_file &, temporary_file const &)
+ -> temporary_file & = delete;
auto operator=(this temporary_file &, temporary_file &&) noexcept
- -> temporary_file &;
+ -> temporary_file & = delete;
private:
// The file descriptor for the file.
diff --git a/nihil.posix/test.fd.cc b/nihil.posix/test.fd.cc
index 8dff323..6b6394b 100644
--- a/nihil.posix/test.fd.cc
+++ b/nihil.posix/test.fd.cc
@@ -64,7 +64,7 @@ TEST_CASE("fd: move construct", "[fd]") {
REQUIRE(fd_is_open(fd1.get()));
auto fd2(std::move(fd1));
- REQUIRE(!fd1);
+ REQUIRE(!fd1); //NOLINT
REQUIRE(fd2);
REQUIRE(fd2.get() == file);
REQUIRE(fd_is_open(file));
@@ -82,7 +82,7 @@ TEST_CASE("fd: move assign", "[fd]") {
fd2 = std::move(fd1);
- REQUIRE(!fd1);
+ REQUIRE(!fd1); //NOLINT
REQUIRE(fd2);
REQUIRE(fd2.get() == file);
REQUIRE(fd_is_open(file));
@@ -94,7 +94,7 @@ TEST_CASE("fd: release", "[fd]") {
auto fd = nihil::fd(file);
auto fdesc = std::move(fd).release();
- REQUIRE(!fd);
+ REQUIRE(!fd); //NOLINT
REQUIRE(fdesc == file);
}