Skip to content

Commit

Permalink
Merge pull request #1283 from Bastian-Krause/bst/console-loop-eof
Browse files Browse the repository at this point in the history
client: fix console --loop on microcom error
  • Loading branch information
Emantor committed Nov 9, 2023
2 parents d08687c + 6df298f commit 1f416df
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions labgrid/remote/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,10 @@ async def _console(self, place, target, timeout, *, logfile=None, loop=False, li
# use zero timeout to prevent blocking sleeps
target.await_resources([resource], timeout=0.0)

if not place.acquired:
print("place released")
return 255

host, port = proxymanager.get_host_and_port(resource)

# check for valid resources
Expand Down Expand Up @@ -856,11 +860,14 @@ async def console(self, place, target):
while True:
res = await self._console(place, target, 10.0, logfile=self.args.logfile,
loop=self.args.loop, listen_only=self.args.listenonly)
if res:
exc = InteractiveCommandError("microcom error")
exc.exitcode = res
raise exc
# place released
if res == 255:
break
if not self.args.loop:
if res:
exc = InteractiveCommandError("microcom error")
exc.exitcode = res
raise exc
break
await asyncio.sleep(1.0)
console.needs_target = True
Expand Down

0 comments on commit 1f416df

Please sign in to comment.