Windows: disable status bar (#3484)

It can randomly lock inside Windows terminal emulators. Better play it
safe.
This commit is contained in:
Ștefan Talpalaru 2022-03-14 10:19:50 +01:00 committed by GitHub
parent 346407ef1c
commit 276762958e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 116 additions and 108 deletions

View File

@ -49,8 +49,10 @@ const
when defined(windows):
{.pragma: windowsOnly.}
{.pragma: posixOnly, hidden.}
else:
{.pragma: windowsOnly, hidden.}
{.pragma: posixOnly.}
type
BNStartUpCmd* {.pure.} = enum
@ -313,11 +315,13 @@ type
name: "metrics-port" }: Port
statusBarEnabled* {.
posixOnly
desc: "Display a status bar at the bottom of the terminal screen"
defaultValue: true
name: "status-bar" }: bool
statusBarContents* {.
posixOnly
desc: "Textual template for the contents of the status bar"
defaultValue: "peers: $connected_peers;" &
"finalized: $finalized_root:$finalized_epoch;" &

View File

@ -1482,7 +1482,8 @@ func formatGwei(amount: uint64): string =
while result[^1] == '0':
result.setLen(result.len - 1)
proc initStatusBar(node: BeaconNode) {.raises: [Defect, ValueError].} =
when not defined(windows):
proc initStatusBar(node: BeaconNode) {.raises: [Defect, ValueError].} =
if not isatty(stdout): return
if not node.config.statusBarEnabled: return
@ -1645,6 +1646,9 @@ proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref BrHmacDrbgContext) {.r
if bnStatus == BeaconNodeStatus.Stopping:
return
when not defined(windows):
# This status bar can lock a Windows terminal emulator, blocking the whole
# event loop (seen on Windows 10, with a default MSYS2 terminal).
initStatusBar(node)
if node.nickname != "":

@ -1 +1 @@
Subproject commit 585059d2fba17a2212fe644782a675b4a6b8dca1
Subproject commit 9826fddd1c828112f3ad240cd3781777614ebbb4