diff --git a/subprocess.hpp b/subprocess.hpp index 45e52c9..0341474 100755 --- a/subprocess.hpp +++ b/subprocess.hpp @@ -1150,11 +1150,6 @@ inline void Popen::execute_process() throw (CalledProcessError, OSError) } exe_name_ = vargs_[0]; - std::signal(SIGCHLD, [](int sig){ - int status; - waitpid(-1, &status, WNOHANG); - }); - child_pid_ = fork(); if (child_pid_ < 0) { diff --git a/test/test_ret_code.cc b/test/test_ret_code.cc new file mode 100644 index 0000000..9e00f25 --- /dev/null +++ b/test/test_ret_code.cc @@ -0,0 +1,18 @@ +#include +#include "../subprocess.hpp" + +namespace sp = subprocess; + +void test_ret_code() +{ + std::cout << "Test::test_poll_ret_code" << std::endl; + auto p = sp::Popen({"/bin/false"}); + while (p.poll() == -1) { + usleep(1000 * 100); + } + assert (p.retcode() == 1); +} + +int main() { + test_ret_code(); +}