title: How to get the exit code of a Boost process?
body: <p>I wondering, how to get the exit code of my child process. The function exit_code() always return 0, doesn't matter terminated (send SIGKILL) or correctly finished.</p>
  <p>I am using boost ver 1.65 and C++0x. I cant change these settings.</p>
  <p>As I read in the documentation:</p>
  <blockquote>
  <p>int exit_code() const;</p>
  <p>Get the exit_code. The return value is without any meaning if the child wasn't waited for or if it was terminated.</p>
  </blockquote>
  <p>So this function is not helping me, but I may could use the error code.</p>
  <pre><code>std::error_code ec;
  bp::system(&quot;g++ main.cpp&quot;, ec);
  </code></pre>
  <p>But std::error_code is only supported since c++11. I tried boost::system::error_code, but thats not correct.</p>
  <p>Here the link to Boost::process:
  <a href="https://www.boost.org/doc/libs/1_65_0/doc/html/boost_process/tutorial.html" rel="nofollow noreferrer">https://www.boost.org/doc/libs/1_65_0/doc/html/boost_process/tutorial.html</a></p>
  <p>Any idea, how to get that exit code?</p>