all the reddit users from the linked article missed the SIGPIPE trick!
you don't need to check the return value from write() as your process will be terminated with SIGPIPE if it tries writing to a closed pipe.
saying that, none of them check the return code correctly: if the consumer only reads a byte at a time you could eventually get 'yyyyyyyyyyyyyyyyyy' (without any newlines)
quite impressive that so many implementations of "yes" have the same bug :)