imgconverter: ensure that connection to the VM is properly closed

Even in case of some error (for example invalid image).

(cherry picked from commit fc3347c914)
This commit is contained in:
Marek Marczykowski-Górecki 2015-08-08 04:22:05 +02:00
parent 5c6ad4c669
commit 4b6924a27b
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -152,8 +152,9 @@ get_from_stream(), get_from_vm(), get_xdg_icon_from_vm(), get_through_dvm()'''
p.stdin.write('{0}\n'.format(src)) p.stdin.write('{0}\n'.format(src))
p.stdin.close() p.stdin.close()
try:
img = cls.get_from_stream(p.stdout, **kwargs) img = cls.get_from_stream(p.stdout, **kwargs)
finally:
p.stdout.close() p.stdout.close()
if p.wait(): if p.wait():
raise Exception('Something went wrong with receiver') raise Exception('Something went wrong with receiver')