|
@@ -2,7 +2,12 @@
|
|
|
#include <httplib.h>
|
|
|
#include <iostream>
|
|
|
#include <thread>
|
|
|
+#ifdef WIN32
|
|
|
+
|
|
|
+#else
|
|
|
#include <wait.h>
|
|
|
+#endif
|
|
|
+
|
|
|
#include <chrono>
|
|
|
|
|
|
using namespace httplib;
|
|
@@ -117,12 +122,17 @@ namespace mdd{
|
|
|
setType("HTTP");
|
|
|
|
|
|
if(!fname.empty()){
|
|
|
- _child_pid = fork();
|
|
|
- if(_child_pid == 0)
|
|
|
- {
|
|
|
- char*const arghs[] = {"python3", (char*const)fname.c_str(), NULL};
|
|
|
- execvp("python3", arghs);
|
|
|
- }
|
|
|
+#ifdef WIN32
|
|
|
+
|
|
|
+#else
|
|
|
+ _child_pid = fork();
|
|
|
+ if (_child_pid == 0)
|
|
|
+ {
|
|
|
+ char* const arghs[] = { "python3", (char* const)fname.c_str(), NULL };
|
|
|
+ execvp("python3", arghs);
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
}
|
|
|
while(!connect()){
|
|
|
std::this_thread::sleep_for(std::chrono::microseconds(500));
|
|
@@ -132,12 +142,18 @@ namespace mdd{
|
|
|
|
|
|
ModuleHTTP::~ModuleHTTP()
|
|
|
{
|
|
|
- if(_child_pid != 0)
|
|
|
- {
|
|
|
- kill(_child_pid, SIGINT);
|
|
|
- int status;
|
|
|
- waitpid(_child_pid, &status, 0);
|
|
|
- }
|
|
|
+#ifdef WIN32
|
|
|
+
|
|
|
+#else
|
|
|
+ if (_child_pid != 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ kill(_child_pid, SIGINT);
|
|
|
+ int status;
|
|
|
+ waitpid(_child_pid, &status, 0);
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
}
|
|
|
|
|
|
bool ModuleHTTP::update() {
|