mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-09-09 23:38:20 -04:00
Merge pull request #5 from yytdfc/dev
Fix Issue #4 adding a SIGCHLD handler.
This commit is contained in:
commit
f650a47250
@ -42,6 +42,7 @@ Documentation for C++ subprocessing libraray.
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <csignal>
|
||||
#include <future>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
@ -1150,6 +1151,11 @@ 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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user