file descriptor close fix

master
Daniel Kolesa 2017-05-08 19:55:59 +02:00
parent 4966830d33
commit 8319674705
1 changed files with 2 additions and 0 deletions

View File

@ -158,6 +158,8 @@ struct pipe {
if (!p) {
throw process_error{errno, std::generic_category()};
}
/* do not close twice, the stream will close it */
fd[std::size_t(write)] = -1;
s.open(p, [](FILE *f) {
std::fclose(f);
});