third_party/libprocess/include/stout/os.hpp
// Write out the string to the file at the current fd position.
Write out the string to the file at the current fd position.
Write out the string to the file at the current fd position .
inline Try<Nothing> write(int fd, const std::string& message)
{
  ssize_t length = ::write(fd, message.data(), message.length());
  if (length == -1) {
    return Try<Nothing>::error(strerror(errno));
  }
  CHECK(length > 0);
  CHECK(static_cast<size_t>(length) == message.length());
  return Nothing();
}
inline Try < Nothing > write ( int fd , const std :: string & message ) { ssize_t length = :: write ( fd , message . data ( ) , message . length ( ) ) ; if ( length == -1 ) { return Try < Nothing > :: error ( strerror ( errno ) ) ; } CHECK ( length > 0 ) ; CHECK ( static_cast < size_t > ( length ) == message . length ( ) ) ; return Nothing ( ) ; }
Write out the string to the file at the current fd position.
Write out the string to the file at the current fd position .
// TODO(benh): Handle a non-blocking fd?