Fixes #1168
Merge pull request #1169 from Araq/sigpipe

Fixes #1168