From f5c83eb9c5f550f95c5a41b48cc7a1ef48df5d56 Mon Sep 17 00:00:00 2001 From: Klemens Morgenstern Date: Mon, 30 Jun 2025 16:26:41 +0800 Subject: [PATCH] wait checks the error code first. See #499. --- include/boost/process/v2/process.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/boost/process/v2/process.hpp b/include/boost/process/v2/process.hpp index 5643e392..f30bc469 100644 --- a/include/boost/process/v2/process.hpp +++ b/include/boost/process/v2/process.hpp @@ -300,6 +300,8 @@ struct basic_process */ bool running() { + if (!process_is_running(exit_status_)) + return false; error_code ec; native_exit_code_type exit_code{}; auto r = process_handle_.running(exit_code, ec); @@ -314,6 +316,8 @@ struct basic_process /// Throwing @overload bool running(error_code & ec) bool running(error_code & ec) noexcept { + if (!process_is_running(exit_status_)) + return false; native_exit_code_type exit_code{}; auto r = process_handle_.running(exit_code, ec); if (!ec && !r)