Commit 3cb67a3c authored by Dominik Charousset's avatar Dominik Charousset

Fix odd error w/ `popen` on FreeBSD

parent 5bc130bc
...@@ -44,6 +44,11 @@ std::thread run_program_impl(actor rc, const char* cpath, ...@@ -44,6 +44,11 @@ std::thread run_program_impl(actor rc, const char* cpath,
oss << " 2>&1"; oss << " 2>&1";
string cmdstr = oss.str(); string cmdstr = oss.str();
return std::thread{ [cmdstr, rc] { return std::thread{ [cmdstr, rc] {
// on FreeBSD, popen() hangs indefinitely in some cases
# ifdef CAF_BSD
system(cmdstr.c_str());
anon_send(rc, "");
# else
string output; string output;
auto fp = popen(cmdstr.c_str(), "r"); auto fp = popen(cmdstr.c_str(), "r");
if (! fp) { if (! fp) {
...@@ -57,6 +62,7 @@ std::thread run_program_impl(actor rc, const char* cpath, ...@@ -57,6 +62,7 @@ std::thread run_program_impl(actor rc, const char* cpath,
} }
pclose(fp); pclose(fp);
anon_send(rc, output); anon_send(rc, output);
# endif
}}; }};
} }
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment