From fe21d10c984c54f530506622dbaf6d726231f19d Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sat, 23 Mar 2024 23:06:17 -0700 Subject: [PATCH] Avoid crash if ddrescue-tui is run offline --- scripts/wk/net.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/wk/net.py b/scripts/wk/net.py index 14b5fc0e..4e56ad32 100644 --- a/scripts/wk/net.py +++ b/scripts/wk/net.py @@ -88,11 +88,15 @@ def mount_backup_shares(read_write: bool = False) -> list[str]: continue # Mount share - proc = mount_network_share(details, mount_point, read_write=read_write) - if proc.returncode: + try: + proc = mount_network_share(details, mount_point, read_write=read_write) + if proc.returncode: + report.append(f'Failed to Mount {mount_str}') + else: + report.append(f'Mounted {mount_str}') + except RuntimeError: + # Assuming we're not connected to a network? report.append(f'Failed to Mount {mount_str}') - else: - report.append(f'Mounted {mount_str}') # Done return report