Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved some issues where execution could not be voluntarily stopped #5654

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
9 changes: 7 additions & 2 deletions avocado/utils/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def get_raw_ssh_command(self, command):
"""
return self._ssh_cmd(self.DEFAULT_OPTIONS, ("-q",), command)

def cmd(self, command, ignore_status=True):
def cmd(self, command, ignore_status=True, timeout=None):
"""
Runs a command over the SSH session

Expand All @@ -217,12 +217,17 @@ def cmd(self, command, ignore_status=True):
in case of either the command or ssh connection
returned with exit status other than zero.
:type ignore_status: bool
:param timeout: Limit the command execution time, if you want the command
to end within a few seconds, you can set a specific time.
:type timeout: float
:returns: The command result object.
:rtype: A :class:`avocado.utils.process.CmdResult` instance.
"""
try:
return process.run(
self.get_raw_ssh_command(command), ignore_status=ignore_status
self.get_raw_ssh_command(command),
ignore_status=ignore_status,
timeout=timeout,
)
except process.CmdError as exc:
if exc.result.exit_status == 255:
Expand Down