lordgamez commented on code in PR #2008:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2008#discussion_r2285109261


##########
extensions/python/PythonDependencyInstaller.cpp:
##########
@@ -49,6 +51,39 @@ std::string encapsulateCommandInQuotesIfNeeded(const 
std::string& command) {
 #endif
 }
 
+#ifdef WIN32
+#define popen _popen
+#define pclose _pclose
+#endif
+
+std::pair<int, std::string> executeProcess(const std::string& command) {
+  std::array<char, 256> buffer{};

Review Comment:
   Updated in 
https://github.com/apache/nifi-minifi-cpp/pull/2008/commits/e63c7c0d27adb6f7670946eb8e3b623054eb82ff



##########
extensions/python/PythonDependencyInstaller.cpp:
##########
@@ -49,6 +51,39 @@ std::string encapsulateCommandInQuotesIfNeeded(const 
std::string& command) {
 #endif
 }
 
+#ifdef WIN32
+#define popen _popen
+#define pclose _pclose
+#endif
+
+std::pair<int, std::string> executeProcess(const std::string& command) {
+  std::array<char, 256> buffer{};
+
+  FILE* pipe = popen(encapsulateCommandInQuotesIfNeeded(command).c_str(), "r");
+  if (!pipe) {
+    return {1, fmt::format("Failed to open pipe for command: {}", command)};
+  }
+
+  std::string result;
+  while (fgets(buffer.data(), gsl::narrow<int>(buffer.size()), pipe) != 
nullptr) {
+    result += buffer.data();
+  }

Review Comment:
   Updated in 
https://github.com/apache/nifi-minifi-cpp/pull/2008/commits/e63c7c0d27adb6f7670946eb8e3b623054eb82ff



##########
extensions/python/PythonDependencyInstaller.cpp:
##########
@@ -49,6 +51,39 @@ std::string encapsulateCommandInQuotesIfNeeded(const 
std::string& command) {
 #endif
 }
 
+#ifdef WIN32
+#define popen _popen
+#define pclose _pclose
+#endif
+
+std::pair<int, std::string> executeProcess(const std::string& command) {

Review Comment:
   Updated in 
https://github.com/apache/nifi-minifi-cpp/pull/2008/commits/e63c7c0d27adb6f7670946eb8e3b623054eb82ff



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to