mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-14 00:46:44 +00:00
chore(wakunode): handle sigsegv signal (#1430)
This commit is contained in:
parent
bcab36902d
commit
34d116ff58
@ -691,7 +691,7 @@ when isMainModule:
|
||||
when defined(windows):
|
||||
# workaround for https://github.com/nim-lang/Nim/issues/4057
|
||||
setupForeignThreadGc()
|
||||
info "Shutting down after receiving SIGINT"
|
||||
notice "Shutting down after receiving SIGINT"
|
||||
waitFor node.stop()
|
||||
quit(QuitSuccess)
|
||||
|
||||
@ -700,12 +700,25 @@ when isMainModule:
|
||||
# Handle SIGTERM
|
||||
when defined(posix):
|
||||
proc handleSigterm(signal: cint) {.noconv.} =
|
||||
info "Shutting down after receiving SIGTERM"
|
||||
notice "Shutting down after receiving SIGTERM"
|
||||
waitFor node.stop()
|
||||
quit(QuitSuccess)
|
||||
|
||||
c_signal(ansi_c.SIGTERM, handleSigterm)
|
||||
|
||||
# Handle SIGSEGV
|
||||
when defined(posix):
|
||||
proc handleSigsegv(signal: cint) {.noconv.} =
|
||||
fatal "Shutting down after receiving SIGSEGV"
|
||||
waitFor node.stop()
|
||||
|
||||
# Only available with --stacktrace:on --linetrace:on
|
||||
writeStackTrace()
|
||||
|
||||
quit(QuitFailure)
|
||||
|
||||
c_signal(ansi_c.SIGSEGV, handleSigsegv)
|
||||
|
||||
info "Node setup complete"
|
||||
|
||||
runForever()
|
||||
|
Loading…
x
Reference in New Issue
Block a user