Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 10 additions & 22 deletions labgrid/remote/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class ServerError(Error):


class InteractiveCommandError(Error):
pass
def __init__(self: Error, msg: str, exitcode: int):
super(InteractiveCommandError, self).__init__(msg)
self.exitcode = exitcode


class ErrorGroup(ExceptionGroup):
Expand Down Expand Up @@ -1099,9 +1101,7 @@ async def console(self, place, target):
break
if not self.args.loop:
if res:
exc = InteractiveCommandError("microcom error")
exc.exitcode = res
raise exc
raise InteractiveCommandError("microcom error", res)
break
await asyncio.sleep(1.0)

Expand Down Expand Up @@ -1301,27 +1301,21 @@ def ssh(self):

res = drv.interact(self.args.leftover)
if res:
exc = InteractiveCommandError("ssh error")
exc.exitcode = res
raise exc
raise InteractiveCommandError("ssh error", res)

def scp(self):
drv = self._get_ssh()

res = drv.scp(src=self.args.src, dst=self.args.dst)
if res:
exc = InteractiveCommandError("scp error")
exc.exitcode = res
raise exc
raise InteractiveCommandError("scp error", res)

def rsync(self):
drv = self._get_ssh()

res = drv.rsync(src=self.args.src, dst=self.args.dst, extra=self.args.leftover)
if res:
exc = InteractiveCommandError("rsync error")
exc.exitcode = res
raise exc
raise InteractiveCommandError("rsync error", res)

def sshfs(self):
drv = self._get_ssh()
Expand Down Expand Up @@ -1359,9 +1353,7 @@ def telnet(self):
args = ["telnet", str(ip)]
res = subprocess.call(args)
if res:
exc = InteractiveCommandError("telnet error")
exc.exitcode = res
raise exc
raise InteractiveCommandError("telnet error", res)

def video(self):
place = self.get_acquired_place()
Expand Down Expand Up @@ -1397,9 +1389,7 @@ def video(self):
else:
res = drv.stream(quality, controls=controls)
if res:
exc = InteractiveCommandError("gst-launch-1.0 error")
exc.exitcode = res
raise exc
raise InteractiveCommandError("gst-launch-1.0 error", res)

def audio(self):
place = self.get_acquired_place()
Expand All @@ -1408,9 +1398,7 @@ def audio(self):
drv = self._get_driver_or_new(target, "USBAudioInputDriver", name=name)
res = drv.play()
if res:
exc = InteractiveCommandError("gst-launch-1.0 error")
exc.exitcode = res
raise exc
raise InteractiveCommandError("gst-launch-1.0 error", res)

def _get_tmc(self):
place = self.get_acquired_place()
Expand Down
Loading