Skip to content

Commit

Permalink
qvm-template: Defer qrexec calls so that they can be omitted if excep…
Browse files Browse the repository at this point in the history
…tions are raised.
  • Loading branch information
WillyPillow committed Aug 3, 2020
1 parent e482b9e commit 69cd285
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions qubesadmin/tools/qvm_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ def check_newline(string, name):
return payload

def qrexec_repoquery(args, app, spec='*', refresh=False):
proc = qrexec_popen(args, app, 'qubes.TemplateSearch')
payload = qrexec_payload(args, app, spec, refresh)
proc = qrexec_popen(args, app, 'qubes.TemplateSearch')
stdout, stderr = proc.communicate(payload.encode('UTF-8'))
stdout = stdout.decode('ASCII')
if proc.wait() != 0:
Expand Down Expand Up @@ -335,10 +335,10 @@ def qrexec_repoquery(args, app, spec='*', refresh=False):

def qrexec_download(args, app, spec, path, dlsize=None, refresh=False):
with open(path, 'wb') as fd:
payload = qrexec_payload(args, app, spec, refresh)
# Don't filter ESCs for binary files
proc = qrexec_popen(args, app, 'qubes.TemplateDownload',
stdout=fd, filter_esc=False)
payload = qrexec_payload(args, app, spec, refresh)
proc.stdin.write(payload.encode('UTF-8'))
proc.stdin.close()
with tqdm.tqdm(desc=spec, total=dlsize, unit_scale=True,
Expand Down

0 comments on commit 69cd285

Please sign in to comment.