+ string const linen(line + '\n');
+ int const size = linen.size();
+ int const written = ::write(fd_, linen.c_str(), size);
+ if (written < size) { // Always mean end of connection.
+ if ((written == -1) && (errno == EPIPE)) {
+ // The program will also receive a SIGPIPE
+ // that must be caught
+ lyxerr << "lyx: Server socket " << fd_
+ << " connection closed while writing." << endl;
+ } else {
+ // Anything else, including errno == EAGAIN, must be
+ // considered IO error. EAGAIN should never happen
+ // when line is small
+ lyxerr << "lyx: Server socket " << fd_
+ << " IO error: " << strerror(errno);
+ }
+ }