mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-24 04:08:32 +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:
|
for node in metadata.bootstrapNodes:
|
||||||
config.bootstrapNodes.add node
|
config.bootstrapNodes.add node
|
||||||
|
|
||||||
## Ctrl+C handling
|
# ## Ctrl+C handling
|
||||||
proc controlCHandler() {.noconv.} =
|
# proc controlCHandler() {.noconv.} =
|
||||||
when defined(windows):
|
# when defined(windows):
|
||||||
# workaround for https://github.com/nim-lang/Nim/issues/4057
|
# # workaround for https://github.com/nim-lang/Nim/issues/4057
|
||||||
try:
|
# try:
|
||||||
setupForeignThreadGc()
|
# setupForeignThreadGc()
|
||||||
except Exception as exc: raiseAssert exc.msg # shouldn't happen
|
# except Exception as exc: raiseAssert exc.msg # shouldn't happen
|
||||||
notice "Shutting down after having received SIGINT"
|
# notice "Shutting down after having received SIGINT"
|
||||||
bnStatus = BeaconNodeStatus.Stopping
|
# bnStatus = BeaconNodeStatus.Stopping
|
||||||
try:
|
# try:
|
||||||
setControlCHook(controlCHandler)
|
# setControlCHook(controlCHandler)
|
||||||
except Exception as exc: # TODO Exception
|
# except Exception as exc: # TODO Exception
|
||||||
warn "Cannot set ctrl-c handler", msg = exc.msg
|
# warn "Cannot set ctrl-c handler", msg = exc.msg
|
||||||
|
|
||||||
# equivalent SIGTERM handler
|
# # equivalent SIGTERM handler
|
||||||
when defined(posix):
|
# when defined(posix):
|
||||||
proc SIGTERMHandler(signal: cint) {.noconv.} =
|
# proc SIGTERMHandler(signal: cint) {.noconv.} =
|
||||||
notice "Shutting down after having received SIGTERM"
|
# notice "Shutting down after having received SIGTERM"
|
||||||
bnStatus = BeaconNodeStatus.Stopping
|
# bnStatus = BeaconNodeStatus.Stopping
|
||||||
c_signal(ansi_c.SIGTERM, SIGTERMHandler)
|
# c_signal(ansi_c.SIGTERM, SIGTERMHandler)
|
||||||
|
|
||||||
block:
|
block:
|
||||||
let res =
|
let res =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user