Close file descriptors when process has exited

This commit is contained in:
TheAssassin 2020-10-07 04:37:50 +02:00
parent 3c21d86574
commit b6a1ba290e

View File

@ -231,8 +231,14 @@ bool process::is_running() {
}
if (result == child_pid_) {
exited_ = true;
// TODO: extract the following lines from both this method and close() to eliminate duplicate code
close_pipe_fd_(stdout_fd_);
stdout_fd_ = -1;
close_pipe_fd_(stderr_fd_);
stderr_fd_ = -1;
exited_ = true;
exit_code_ = check_waitpid_status_(status);
return false;