1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-26 00:38:10 +00:00

Use wait_for for waiting a process with python 3.5

This commit is contained in:
Julien Duponchelle 2016-11-17 18:09:46 +01:00
parent a14ad2fc99
commit dcff51eb75
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -77,6 +77,9 @@ def wait_for_process_termination(process, timeout=10):
:param timeout: Timeout in seconds :param timeout: Timeout in seconds
""" """
if sys.version_info >= (3,5):
yield from asyncio.wait_for(process.wait(), timeout=timeout)
else:
while timeout > 0: while timeout > 0:
if process.returncode is not None: if process.returncode is not None:
return return