The opErrror processing does not seem to work. TBH I do not understand the code (still new to golang) When I replace it with checks like error.Is(err,syscall.EPIPE) instead , etc. which seems to handle the errors correctly.