Skip to content

Commit

Permalink
Use a context manager to clean up after qrexec call
Browse files Browse the repository at this point in the history
This avoids leaking a subprocess.Popen object.
  • Loading branch information
DemiMarie committed Jul 10, 2022
1 parent accfebc commit 8bc809e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions qvm-tools/qvm-sync-clock
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def main():
clockvm.name))
sys.exit(0)

p = clockvm.run_service('qubes.GetDate+nanoseconds')
untrusted_date_out = p.stdout.read(36)
with clockvm.run_service('qubes.GetDate+nanoseconds') as p:
untrusted_date_out = p.stdout.read(36)
try:
untrusted_date_out.decode('ascii', 'strict')
except UnicodeDecodeError:
Expand Down

0 comments on commit 8bc809e

Please sign in to comment.