Merge pull request #10187 from accumulator/hww_offline_err_fix
don't sys.exit() from run_offline_command, this leads to wait on lock that never releases
This commit is contained in:
13
run_electrum
13
run_electrum
@@ -211,8 +211,7 @@ def get_connected_hw_devices(plugins: 'Plugins'):
|
|||||||
def get_password_for_hw_device_encrypted_storage(plugins: 'Plugins') -> str:
|
def get_password_for_hw_device_encrypted_storage(plugins: 'Plugins') -> str:
|
||||||
devices = get_connected_hw_devices(plugins)
|
devices = get_connected_hw_devices(plugins)
|
||||||
if len(devices) == 0:
|
if len(devices) == 0:
|
||||||
print_msg("Error: No connected hw device found. Cannot decrypt this wallet.")
|
raise UserFacingException("Error: No connected hw device found. Cannot decrypt this wallet.")
|
||||||
sys.exit(1)
|
|
||||||
elif len(devices) > 1:
|
elif len(devices) > 1:
|
||||||
print_msg("Warning: multiple hardware devices detected. "
|
print_msg("Warning: multiple hardware devices detected. "
|
||||||
"The first one will be used to decrypt the wallet.")
|
"The first one will be used to decrypt the wallet.")
|
||||||
@@ -224,7 +223,7 @@ def get_password_for_hw_device_encrypted_storage(plugins: 'Plugins') -> str:
|
|||||||
client.handler = client.plugin.create_handler(None)
|
client.handler = client.plugin.create_handler(None)
|
||||||
return client.get_password_for_storage_encryption()
|
return client.get_password_for_storage_encryption()
|
||||||
except UserCancelled:
|
except UserCancelled:
|
||||||
sys.exit(0)
|
raise
|
||||||
|
|
||||||
|
|
||||||
async def run_offline_command(config: 'SimpleConfig', config_options: dict, wallet_path: str, plugins: 'Plugins'):
|
async def run_offline_command(config: 'SimpleConfig', config_options: dict, wallet_path: str, plugins: 'Plugins'):
|
||||||
@@ -251,7 +250,7 @@ async def run_offline_command(config: 'SimpleConfig', config_options: dict, wall
|
|||||||
wallet.check_password(password)
|
wallet.check_password(password)
|
||||||
except InvalidPassword:
|
except InvalidPassword:
|
||||||
print_msg("Error: This password does not decode this wallet.")
|
print_msg("Error: This password does not decode this wallet.")
|
||||||
sys.exit(1)
|
raise
|
||||||
if cmd.requires_network:
|
if cmd.requires_network:
|
||||||
print_msg("Warning: running command offline")
|
print_msg("Warning: running command offline")
|
||||||
# arguments passed to function
|
# arguments passed to function
|
||||||
@@ -592,6 +591,12 @@ def handle_cmd(*, cmdname: str, config: 'SimpleConfig', config_options: dict):
|
|||||||
except UserFacingException as e:
|
except UserFacingException as e:
|
||||||
print_stderr(str(e))
|
print_stderr(str(e))
|
||||||
sys_exit(1)
|
sys_exit(1)
|
||||||
|
except InvalidPassword:
|
||||||
|
print_stderr("Invalid password")
|
||||||
|
sys_exit(1)
|
||||||
|
except UserCancelled:
|
||||||
|
print_stderr("Aborted by user")
|
||||||
|
sys_exit(1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_logger.exception("error running command (without daemon)")
|
_logger.exception("error running command (without daemon)")
|
||||||
sys_exit(1)
|
sys_exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user