chgserver: discard buffered output before restoring fds (issue6207)
On Python 3, flush() appears not discarding buffered data on EPIPE, and
the buffered data will be carried over to the restored stdout.
#require docutils gettext $ $TESTDIR/check-gendoc zh_TW checking for parse errors