]> Git Repo - qemu.git/commit
python/qemu: qmp: Make QEMUMonitorProtocol a context manager
authorWainer dos Santos Moschetta <[email protected]>
Tue, 4 Feb 2020 14:11:10 +0000 (11:11 -0300)
committerPhilippe Mathieu-Daudé <[email protected]>
Fri, 7 Feb 2020 14:12:48 +0000 (15:12 +0100)
commit07608e807d4e7bd2daa7fe154bd9dc2235c1a323
tree38a24e66e3b91d3e5985ff50d03659d7a37d6bd5
parent54aafc2fc65231871e744308705c4aa6d283a22d
python/qemu: qmp: Make QEMUMonitorProtocol a context manager

This implement the __enter__ and __exit__ functions on
QEMUMonitorProtocol class so that it can be used on 'with'
statement and the resources will be free up on block end:

with QEMUMonitorProtocol(socket_path) as qmp:
    qmp.connect()
    qmp.command('query-status')

Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
Reviewed-by: John Snow <[email protected]>
Message-Id: <20200204141111[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
python/qemu/qmp.py
This page took 0.025571 seconds and 4 git commands to generate.