Skip to content

Commit

Permalink
MINIFICPP-2506 Fix a gcc warning
Browse files Browse the repository at this point in the history
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 apache#1912

Signed-off-by: Marton Szasz <[email protected]>
  • Loading branch information
fgerlits authored and szaszm committed Dec 29, 2024
1 parent 5c5fc89 commit b194ce5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion extensions/python/pythonlibloader/PythonLibLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
}
Expand Down

0 comments on commit b194ce5

Please sign in to comment.