commit
c40f2d682e
2 changed files with 12 additions and 1 deletions
|
|
@ -57,6 +57,7 @@ when not defined(SIGINT):
|
||||||
SIGINT = cint(2)
|
SIGINT = cint(2)
|
||||||
SIGSEGV = cint(11)
|
SIGSEGV = cint(11)
|
||||||
SIGTERM = cint(15)
|
SIGTERM = cint(15)
|
||||||
|
SIGPIPE = cint(13)
|
||||||
else:
|
else:
|
||||||
{.error: "SIGABRT not ported to your platform".}
|
{.error: "SIGABRT not ported to your platform".}
|
||||||
else:
|
else:
|
||||||
|
|
@ -66,6 +67,8 @@ when not defined(SIGINT):
|
||||||
SIGABRT {.importc: "SIGABRT", nodecl.}: cint
|
SIGABRT {.importc: "SIGABRT", nodecl.}: cint
|
||||||
SIGFPE {.importc: "SIGFPE", nodecl.}: cint
|
SIGFPE {.importc: "SIGFPE", nodecl.}: cint
|
||||||
SIGILL {.importc: "SIGILL", nodecl.}: cint
|
SIGILL {.importc: "SIGILL", nodecl.}: cint
|
||||||
|
when defined(macosx) or defined(linux):
|
||||||
|
var SIGPIPE {.importc: "SIGPIPE", nodecl.}: cint
|
||||||
|
|
||||||
when defined(macosx):
|
when defined(macosx):
|
||||||
when NoFakeVars:
|
when NoFakeVars:
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,13 @@ when not defined(noSignalHandler):
|
||||||
elif s == SIGILL: action("SIGILL: Illegal operation.\n")
|
elif s == SIGILL: action("SIGILL: Illegal operation.\n")
|
||||||
elif s == SIGBUS:
|
elif s == SIGBUS:
|
||||||
action("SIGBUS: Illegal storage access. (Attempt to read from nil?)\n")
|
action("SIGBUS: Illegal storage access. (Attempt to read from nil?)\n")
|
||||||
else: action("unknown signal\n")
|
else:
|
||||||
|
block platformSpecificSignal:
|
||||||
|
when defined(SIGPIPE):
|
||||||
|
if s == SIGPIPE:
|
||||||
|
action("SIGPIPE: Pipe closed.\n")
|
||||||
|
break platformSpecificSignal
|
||||||
|
action("unknown signal\n")
|
||||||
|
|
||||||
# print stack trace and quit
|
# print stack trace and quit
|
||||||
when hasSomeStackTrace:
|
when hasSomeStackTrace:
|
||||||
|
|
@ -323,6 +329,8 @@ when not defined(noSignalHandler):
|
||||||
c_signal(SIGFPE, signalHandler)
|
c_signal(SIGFPE, signalHandler)
|
||||||
c_signal(SIGILL, signalHandler)
|
c_signal(SIGILL, signalHandler)
|
||||||
c_signal(SIGBUS, signalHandler)
|
c_signal(SIGBUS, signalHandler)
|
||||||
|
when defined(SIGPIPE):
|
||||||
|
c_signal(SIGPIPE, signalHandler)
|
||||||
|
|
||||||
registerSignalHandler() # call it in initialization section
|
registerSignalHandler() # call it in initialization section
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue