From 0fa061db967418f2a1ad08336c477a1f84a3f023 Mon Sep 17 00:00:00 2001 From: Stefano Bonicatti Date: Tue, 9 Apr 2024 15:54:14 +0200 Subject: [PATCH] Add logging to help debugging start failure --- osquery/process/posix/process.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osquery/process/posix/process.cpp b/osquery/process/posix/process.cpp index 06bfd99d013..270ea2ddd66 100644 --- a/osquery/process/posix/process.cpp +++ b/osquery/process/posix/process.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -185,7 +186,8 @@ std::shared_ptr PlatformProcess::launchExtension( ::execve(arguments[0], argv, ::environ); // Code should never reach this point - LOG(ERROR) << "Could not start extension process: " << exec_path; + std::cerr << "Could not start extension process: " << exec_path + << ", error: " << errno << std::endl; ::exit(EXIT_FAILURE); return std::shared_ptr(); } @@ -227,7 +229,13 @@ std::shared_ptr PlatformProcess::launchTestPythonScript( if (process_pid == 0) { // Start a Python script ::execvp(osquery_python_path.c_str(), argv); - ::exit(0); + + std::string args = boost::algorithm::join(args_array, " "); + + // Should not reach this if everything executes correctly + std::cerr << "Could not start process at " << osquery_python_path + << ", args: " << args << ", error: " << errno << std::endl; + ::exit(EXIT_FAILURE); } else if (process_pid > 0) { process.reset(new PlatformProcess(process_pid)); }