Skip to content

Commit 9ab0e60

Browse files
remote/client: update resources before checking NetworkSerialPort availability
PR #935 added async waiting for the NetworkSerialPort. This makes `labgrid-client console --loop` work as long as the resource changes from being unavailable to being available. It does not work vice versa, however: the resources are not being updated before being checked for availability. The code inside the while loop does not run in this case. This makes the subsequent `target.await_resources()` raise a NoResourceFoundError which is not handled anywhere causing an error message and exit of labgrid-client despite being called with ``--loop``. Fix that by updating the resources before checking the resource's availability. `labgrid-client console --loop` will now loop even if the NetworkSerialPort changes from being available to unavailable. Fixes: 2230536 ("remote/client: no block in async console, loop even on unavailable resource") Signed-off-by: Bastian Krause <[email protected]>
1 parent 79d1dff commit 9ab0e60

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

labgrid/remote/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,10 @@ async def _console(self, place, target, timeout, *, logfile=None, loop=False):
856856

857857
# async await resources
858858
timeout = Timeout(timeout)
859-
while not resource.avail and (loop or not timeout.expired):
859+
while True:
860860
target.update_resources()
861+
if resource.avail or (not loop and timeout.expired):
862+
break
861863
await asyncio.sleep(0.1)
862864

863865
# use zero timeout to prevent blocking sleeps

0 commit comments

Comments
 (0)