Skip to content

Commit 3bd542b

Browse files
committed
Merge pull request #1795 from akaufmann/devel
ignore signal SIGPIPE on Darwin
2 parents da36a84 + 85c22f3 commit 3bd542b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/posix/posix.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,9 +1570,9 @@ else:
15701570

15711571

15721572
when defined(macosx):
1573+
# We can't use the NOSIGNAL flag in the ``send`` function, it has no effect
15731574
var
1574-
MSG_HAVEMORE* {.importc, header: "<sys/socket.h>".}: cint
1575-
MSG_NOSIGNAL* = MSG_HAVEMORE
1575+
MSG_NOSIGNAL* = 0'i32
15761576
else:
15771577
var
15781578
MSG_NOSIGNAL* {.importc, header: "<sys/socket.h>".}: cint

lib/pure/rawsockets.nim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,10 @@ proc selectWrite*(writefds: var seq[SocketHandle],
428428

429429
pruneSocketSet(writefds, (wr))
430430

431+
# We ignore signal SIGPIPE on Darwin
432+
when defined(macosx):
433+
signal(SIGPIPE, SIG_IGN)
434+
431435
when defined(Windows):
432436
var wsa: WSAData
433437
if wsaStartup(0x0101'i16, addr wsa) != 0: raiseOSError(osLastError())

0 commit comments

Comments
 (0)