From 85c22f334832cc7cf5e2b01a23eb1c1b63189cfe Mon Sep 17 00:00:00 2001 From: Andre Date: Tue, 30 Dec 2014 23:39:43 +0100 Subject: [PATCH] ignore signal SIGPIPE on Darwin --- lib/posix/posix.nim | 4 ++-- lib/pure/rawsockets.nim | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index deb120372c..0498a0e709 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -1570,9 +1570,9 @@ else: when defined(macosx): + # We can't use the NOSIGNAL flag in the ``send`` function, it has no effect var - MSG_HAVEMORE* {.importc, header: "".}: cint - MSG_NOSIGNAL* = MSG_HAVEMORE + MSG_NOSIGNAL* = 0'i32 else: var MSG_NOSIGNAL* {.importc, header: "".}: cint diff --git a/lib/pure/rawsockets.nim b/lib/pure/rawsockets.nim index 62a011999b..e23deea5bd 100644 --- a/lib/pure/rawsockets.nim +++ b/lib/pure/rawsockets.nim @@ -428,6 +428,10 @@ proc selectWrite*(writefds: var seq[SocketHandle], pruneSocketSet(writefds, (wr)) +# We ignore signal SIGPIPE on Darwin +when defined(macosx): + signal(SIGPIPE, SIG_IGN) + when defined(Windows): var wsa: WSAData if wsaStartup(0x0101'i16, addr wsa) != 0: raiseOSError(osLastError())