connect_to_testnet.nims: don't die when GNU getopts is missing

This commit is contained in:
Ștefan Talpalaru 2020-06-11 04:11:30 +02:00
parent 7aec3dfc4b
commit 8e648da399
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
1 changed files with 7 additions and 6 deletions

View File

@ -111,12 +111,6 @@ cli do (skipGoerliKey {.
echo "Detected testnet restart. Deleting previous database..." echo "Detected testnet restart. Deleting previous database..."
rmDir dataDir rmDir dataDir
cd rootDir
exec &"""./scripts/make_prometheus_config.sh --nodes 1 --base-metrics-port 8008 --config-file "{dataDir}/prometheus.yml""""
exec &"""nim c {nimFlags} -d:"const_preset={preset}" -o:"{beaconNodeBinary}" beacon_chain/beacon_node.nim"""
proc execIgnoringExitCode(s: string) = proc execIgnoringExitCode(s: string) =
# reduces the error output when interrupting an external command with Ctrl+C # reduces the error output when interrupting an external command with Ctrl+C
try: try:
@ -124,6 +118,13 @@ cli do (skipGoerliKey {.
except OsError: except OsError:
discard discard
cd rootDir
# macOS may not have gnu-getopts installed and in the PATH
execIgnoringExitCode &"""./scripts/make_prometheus_config.sh --nodes 1 --base-metrics-port 8008 --config-file "{dataDir}/prometheus.yml""""
exec &"""nim c {nimFlags} -d:"const_preset={preset}" -o:"{beaconNodeBinary}" beacon_chain/beacon_node.nim"""
if not skipGoerliKey and depositContractOpt.len > 0 and not system.dirExists(validatorsDir): if not skipGoerliKey and depositContractOpt.len > 0 and not system.dirExists(validatorsDir):
mode = Silent mode = Silent
echo "\nPlease enter your Goerli Eth1 private key in hex form (e.g. 0x1a2...f3c) in order to become a validator (you'll need access to 32 GoETH)." echo "\nPlease enter your Goerli Eth1 private key in hex form (e.g. 0x1a2...f3c) in order to become a validator (you'll need access to 32 GoETH)."