diff --git a/qubes/ext/utils.py b/qubes/ext/utils.py index 4a7ae9bf1..4c005c0a5 100644 --- a/qubes/ext/utils.py +++ b/qubes/ext/utils.py @@ -20,6 +20,7 @@ # USA. import asyncio import subprocess +import sys import qubes @@ -138,11 +139,15 @@ def confirm_device_attachment(device, frontends) -> str: guivm = 'dom0' # TODO # TODO: guivm rpc? - proc = subprocess.Popen( - ["attach-confirm", guivm, - device.backend_domain.name, device.port_id, - device.description, - *[f.name for f in frontends.keys()]], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (target_name, _) = proc.communicate() - return target_name.decode() + try: + proc = subprocess.Popen( + ["attach-confirm", guivm, + device.backend_domain.name, device.port_id, + device.description, + *[f.name for f in frontends.keys()]], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (target_name, _) = proc.communicate() + return target_name.decode() + except Exception as exc: + print(exc, file=sys.stderr) + return ""