Files
textmate/Frameworks/io/src/pipe.cc
Allan Odgaard 3415d775c5 Use symbolic name for FD_CLOEXEC
Unsure why I was using ‘1’ — perhaps the symbolic name was missing in the older SDK.
2012-08-24 16:52:45 +02:00

19 lines
318 B
C++

#include "pipe.h"
namespace io
{
void create_pipe (int& read_pipe, int& write_pipe, bool close_on_exec)
{
int pipes[2];
pipe(&pipes[0]);
read_pipe = pipes[0];
write_pipe = pipes[1];
if(close_on_exec)
{
fcntl(pipes[0], F_SETFD, FD_CLOEXEC);
fcntl(pipes[1], F_SETFD, FD_CLOEXEC);
}
}
} /* io */