mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 07:07:45 +01:00
contrib: return non-zero status if getcoins.py errors
This commit is contained in:
parent
8c203cf0e1
commit
42dbd9025a
1 changed files with 4 additions and 4 deletions
|
@ -30,11 +30,11 @@ def bitcoin_cli(rpc_command_and_params):
|
||||||
return subprocess.check_output(argv).strip().decode()
|
return subprocess.check_output(argv).strip().decode()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print('The binary', args.cmd, 'could not be found.')
|
print('The binary', args.cmd, 'could not be found.')
|
||||||
exit()
|
exit(1)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
cmdline = ' '.join(argv)
|
cmdline = ' '.join(argv)
|
||||||
print(f'-----\nError while calling "{cmdline}" (see output above).')
|
print(f'-----\nError while calling "{cmdline}" (see output above).')
|
||||||
exit()
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
if args.faucet.lower() == DEFAULT_GLOBAL_FAUCET:
|
if args.faucet.lower() == DEFAULT_GLOBAL_FAUCET:
|
||||||
|
@ -42,7 +42,7 @@ if args.faucet.lower() == DEFAULT_GLOBAL_FAUCET:
|
||||||
curr_signet_hash = bitcoin_cli(['getblockhash', '1'])
|
curr_signet_hash = bitcoin_cli(['getblockhash', '1'])
|
||||||
if curr_signet_hash != GLOBAL_FIRST_BLOCK_HASH:
|
if curr_signet_hash != GLOBAL_FIRST_BLOCK_HASH:
|
||||||
print('The global faucet cannot be used with a custom Signet network. Please use the global signet or setup your custom faucet to use this functionality.\n')
|
print('The global faucet cannot be used with a custom Signet network. Please use the global signet or setup your custom faucet to use this functionality.\n')
|
||||||
exit()
|
exit(1)
|
||||||
|
|
||||||
if args.addr == '':
|
if args.addr == '':
|
||||||
# get address for receiving coins
|
# get address for receiving coins
|
||||||
|
@ -53,7 +53,7 @@ try:
|
||||||
res = requests.post(args.faucet, data=data)
|
res = requests.post(args.faucet, data=data)
|
||||||
except:
|
except:
|
||||||
print('Unexpected error when contacting faucet:', sys.exc_info()[0])
|
print('Unexpected error when contacting faucet:', sys.exc_info()[0])
|
||||||
exit()
|
exit(1)
|
||||||
|
|
||||||
# Display the output as per the returned status code
|
# Display the output as per the returned status code
|
||||||
if res:
|
if res:
|
||||||
|
|
Loading…
Add table
Reference in a new issue