Skip to content

Commit

Permalink
commented ctrl+c handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Miranda committed Jan 17, 2025
1 parent 633c044 commit 0fe437f
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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

# 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)
# ## 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)

block:
let res =
Expand Down

0 comments on commit 0fe437f

Please sign in to comment.