2
0
mirror of https://github.com/boostorg/process.git synced 2026-02-01 08:42:15 +00:00

fixed self-pipe issue

This commit is contained in:
Klemens David Morgenstern
2019-04-06 14:42:08 +08:00
parent b8821eac57
commit b294710e60
4 changed files with 15 additions and 7 deletions

View File

@@ -372,11 +372,14 @@ child executor<Sequence>::invoke(boost::mpl::false_, boost::mpl::false_)
struct pipe_guard
{
int p[2];
pipe_guard() : p{-1,-1} {}
~pipe_guard()
{
::close(p[0]);
::close(p[1]);
if (p[0] != -1)
::close(p[0]);
if (p[1] != -1)
::close(p[1]);
}
} p{};
@@ -430,8 +433,10 @@ child executor<Sequence>::invoke(boost::mpl::false_, boost::mpl::false_)
return child();
}
::close(p.p[1]);
p.p[1] = -1;
_read_error(p.p[0]);
}
if (_ec)
{