From b194ce55dc39daea339f32f3c8cb0c844ff33a0e Mon Sep 17 00:00:00 2001 From: Ferenc Gerlits Date: Sun, 29 Dec 2024 21:00:42 +0100 Subject: [PATCH] MINIFICPP-2506 Fix a gcc warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a GCC warning in PythonLibLoader.cpp, so minifi does not compile with ENABLE_PYTHON_SCRIPTING and MINIFI_FAIL_ON_WARNINGS both ON. The warning: ``` /home/runner/work/nifi-minifi-cpp/nifi-minifi-cpp/extensions/python/pythonlibloader/PythonLibLoader.cpp: In static member function ‘static std::string PythonLibLoader::execCommand(const std::string&)’: /home/runner/work/nifi-minifi-cpp/nifi-minifi-cpp/extensions/python/pythonlibloader/PythonLibLoader.cpp:78:44: error: ignoring attributes on template argument ‘int (*)(FILE*)’ [-Werror=ignored-attributes] 78 | std::unique_ptr pipe(popen(cmd.c_str(), "r"), pclose); | ^ ``` Closes #1912 Signed-off-by: Marton Szasz --- extensions/python/pythonlibloader/PythonLibLoader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/python/pythonlibloader/PythonLibLoader.cpp b/extensions/python/pythonlibloader/PythonLibLoader.cpp index 6407982e37..8c2d7ec551 100644 --- a/extensions/python/pythonlibloader/PythonLibLoader.cpp +++ b/extensions/python/pythonlibloader/PythonLibLoader.cpp @@ -75,7 +75,8 @@ class PythonLibLoader { static std::string execCommand(const std::string& cmd) { std::array buffer{}; std::string result; - std::unique_ptr pipe(popen(cmd.c_str(), "r"), pclose); + struct pclose_deleter { void operator()(FILE* file) noexcept { pclose(file); } }; + std::unique_ptr pipe{popen(cmd.c_str(), "r")}; if (!pipe) { return ""; }