| 427 | } |
| 428 | |
| 429 | void Process::close_fds() noexcept { |
| 430 | if (stdout_stderr_thread.joinable()) |
| 431 | stdout_stderr_thread.join(); |
| 432 | |
| 433 | if (stdin_fd) |
| 434 | close_stdin(); |
| 435 | if (stdout_fd) { |
| 436 | if (data.id > 0) |
| 437 | close(*stdout_fd); |
| 438 | stdout_fd.reset(); |
| 439 | } |
| 440 | if (stderr_fd) { |
| 441 | if (data.id > 0) |
| 442 | close(*stderr_fd); |
| 443 | stderr_fd.reset(); |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | bool Process::write(const char* bytes, size_t n) { |
| 448 | if (!open_stdin) |