| 321 | } |
| 322 | |
| 323 | void Process::close_fds() noexcept { |
| 324 | if(stdout_thread.joinable()) |
| 325 | stdout_thread.join(); |
| 326 | if(stderr_thread.joinable()) |
| 327 | stderr_thread.join(); |
| 328 | |
| 329 | if(stdin_fd) |
| 330 | close_stdin(); |
| 331 | if(stdout_fd) { |
| 332 | if(*stdout_fd != nullptr) |
| 333 | CloseHandle(*stdout_fd); |
| 334 | stdout_fd.reset(); |
| 335 | } |
| 336 | if(stderr_fd) { |
| 337 | if(*stderr_fd != nullptr) |
| 338 | CloseHandle(*stderr_fd); |
| 339 | stderr_fd.reset(); |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | bool Process::write(const char *bytes, size_t n) { |
| 344 | if(!open_stdin) |