diff --git a/include/boost/process/v2/posix/default_launcher.hpp b/include/boost/process/v2/posix/default_launcher.hpp index fc826fea2..7a2018c43 100644 --- a/include/boost/process/v2/posix/default_launcher.hpp +++ b/include/boost/process/v2/posix/default_launcher.hpp @@ -411,7 +411,8 @@ struct default_launcher if (ec) { detail::on_error(*this, executable, argv, ec, inits...); - do { ::waitpid(pid, nullptr, 0); } while (errno == EINTR); + int res = 0; + do { res = ::waitpid(pid, nullptr, 0); } while ((res == -1) && (errno == EINTR)); return basic_process{exec}; } } diff --git a/include/boost/process/v2/posix/fork_and_forget_launcher.hpp b/include/boost/process/v2/posix/fork_and_forget_launcher.hpp index f86314dee..26a1e6e45 100644 --- a/include/boost/process/v2/posix/fork_and_forget_launcher.hpp +++ b/include/boost/process/v2/posix/fork_and_forget_launcher.hpp @@ -124,7 +124,8 @@ struct fork_and_forget_launcher : default_launcher if (ec) { detail::on_error(*this, executable, argv, ec, inits...); - do { ::waitpid(pid, nullptr, 0); } while (errno == EINTR); + int res = 0; + do { res = ::waitpid(pid, nullptr, 0); } while ((res != -1) && (errno == EINTR)); return basic_process{exec}; } } diff --git a/include/boost/process/v2/posix/pdfork_launcher.hpp b/include/boost/process/v2/posix/pdfork_launcher.hpp index 0a082f562..5affc51e9 100644 --- a/include/boost/process/v2/posix/pdfork_launcher.hpp +++ b/include/boost/process/v2/posix/pdfork_launcher.hpp @@ -161,7 +161,8 @@ struct pdfork_launcher : default_launcher if (ec) { detail::on_error(*this, executable, argv, ec, inits...); - do { ::waitpid(pid, nullptr, 0); } while (errno == EINTR); + int res = 0; + do { res = ::waitpid(pid, nullptr, 0); } while ((res == -1) && (errno == EINTR)); return basic_process{exec}; } } diff --git a/include/boost/process/v2/posix/vfork_launcher.hpp b/include/boost/process/v2/posix/vfork_launcher.hpp index bb1b9f2ca..49e2a70b0 100644 --- a/include/boost/process/v2/posix/vfork_launcher.hpp +++ b/include/boost/process/v2/posix/vfork_launcher.hpp @@ -121,7 +121,8 @@ struct vfork_launcher : default_launcher if (ec) { detail::on_error(*this, executable, argv, ec, inits...); - do { ::waitpid(pid, nullptr, 0); } while (errno == EINTR); + int res = 0; + do { res = ::waitpid(pid, nullptr, 0); } while ((res != -1) && (errno == EINTR)); return basic_process{exec}; }