This is an automated email from the ASF dual-hosted git repository.

szaszm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit b194ce55dc39daea339f32f3c8cb0c844ff33a0e
Author: Ferenc Gerlits <[email protected]>
AuthorDate: Sun Dec 29 21:00:42 2024 +0100

    MINIFICPP-2506 Fix a gcc warning
    
    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<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(), 
"r"), pclose);
     | ^
    ```
    
    Closes #1912
    
    Signed-off-by: Marton Szasz <[email protected]>
---
 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 6407982e3..8c2d7ec55 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<char, 128> buffer{};
     std::string result;
-    std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(), "r"), 
pclose);
+    struct pclose_deleter { void operator()(FILE* file) noexcept { 
pclose(file); } };
+    std::unique_ptr<FILE, pclose_deleter> pipe{popen(cmd.c_str(), "r")};
     if (!pipe) {
       return "";
     }

Reply via email to