mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-23 11:48:33 +00:00
commented ctrl+c handler
This commit is contained in:
parent
633c04443b
commit
0fe437f4e4
@ -2398,26 +2398,26 @@ proc doRunBeaconNode*(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.ra
|
||||
for node in metadata.bootstrapNodes:
|
||||
config.bootstrapNodes.add node
|
||||
|
||||
## Ctrl+C handling
|
||||
proc controlCHandler() {.noconv.} =
|
||||
when defined(windows):
|
||||
# workaround for https://github.com/nim-lang/Nim/issues/4057
|
||||
try:
|
||||
setupForeignThreadGc()
|
||||
except Exception as exc: raiseAssert exc.msg # shouldn't happen
|
||||
notice "Shutting down after having received SIGINT"
|
||||
bnStatus = BeaconNodeStatus.Stopping
|
||||
try:
|
||||
setControlCHook(controlCHandler)
|
||||
except Exception as exc: # TODO Exception
|
||||
warn "Cannot set ctrl-c handler", msg = exc.msg
|
||||
# ## Ctrl+C handling
|
||||
# proc controlCHandler() {.noconv.} =
|
||||
# when defined(windows):
|
||||
# # workaround for https://github.com/nim-lang/Nim/issues/4057
|
||||
# try:
|
||||
# setupForeignThreadGc()
|
||||
# except Exception as exc: raiseAssert exc.msg # shouldn't happen
|
||||
# notice "Shutting down after having received SIGINT"
|
||||
# bnStatus = BeaconNodeStatus.Stopping
|
||||
# try:
|
||||
# setControlCHook(controlCHandler)
|
||||
# except Exception as exc: # TODO Exception
|
||||
# warn "Cannot set ctrl-c handler", msg = exc.msg
|
||||
|
||||
# equivalent SIGTERM handler
|
||||
when defined(posix):
|
||||
proc SIGTERMHandler(signal: cint) {.noconv.} =
|
||||
notice "Shutting down after having received SIGTERM"
|
||||
bnStatus = BeaconNodeStatus.Stopping
|
||||
c_signal(ansi_c.SIGTERM, SIGTERMHandler)
|
||||
# # equivalent SIGTERM handler
|
||||
# when defined(posix):
|
||||
# proc SIGTERMHandler(signal: cint) {.noconv.} =
|
||||
# notice "Shutting down after having received SIGTERM"
|
||||
# bnStatus = BeaconNodeStatus.Stopping
|
||||
# c_signal(ansi_c.SIGTERM, SIGTERMHandler)
|
||||
|
||||
block:
|
||||
let res =
|
||||
|
Loading…
x
Reference in New Issue
Block a user