Skip to content

Commit 9f19108

Browse files
committed
q-dev: error handling
1 parent 2514885 commit 9f19108

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

qubes/ext/utils.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# USA.
2121
import asyncio
2222
import subprocess
23+
import sys
2324

2425
import qubes
2526

@@ -138,11 +139,15 @@ def confirm_device_attachment(device, frontends) -> str:
138139
guivm = 'dom0' # TODO
139140
# TODO: guivm rpc?
140141

141-
proc = subprocess.Popen(
142-
["attach-confirm", guivm,
143-
device.backend_domain.name, device.port_id,
144-
device.description,
145-
*[f.name for f in frontends.keys()]],
146-
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
147-
(target_name, _) = proc.communicate()
148-
return target_name.decode()
142+
try:
143+
proc = subprocess.Popen(
144+
["attach-confirm", guivm,
145+
device.backend_domain.name, device.port_id,
146+
device.description,
147+
*[f.name for f in frontends.keys()]],
148+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
149+
(target_name, _) = proc.communicate()
150+
return target_name.decode()
151+
except Exception as exc:
152+
print(exc, file=sys.stderr)
153+
return ""

0 commit comments

Comments
 (0)