When I run your code on a linux box, the child process
catches a SIGPIPE after telnet exits *and* it tries to
subsequently write to the socket:
broken pipe at ././test-server2 line 50
main::SELFREAP('PIPE') called at ././test-server2 line 85
main::__ANON__() called at ././test-server2 line 121
main::spawn('CODE(0x80cdb14)') called at ././test-server2 line
+ 96
broken pipe at ././test-server2 line 50
main::SELFREAP('PIPE') called at ././test-server2 line 0
././test-server2 9192: reaped 9761 with exit 7424 at Wed Apr 5 12:23:
+32 2000
What platform are you running on. Trying to write to a
closed socket should definitely generate a SIGPIPE.