Create a pair of connected file descriptors

namespace HH\Lib\OS;

function pipe(): (FileDescriptor, FileDescriptor);

See man 2 pipe for details. On error, an ErrnoException will be thrown.

O_CLOEXEC is implicitly set for consistent behavior between standalone CLI mode and server modes. Use OS\fcntl() to remove if needed.


  • Two - FileDescriptors; the first is read-only, and the second is write-only. Data written to the second can be read from the first.