Apply process timeout to process.send_all method from sh.execute

It makes sense that the command execution timeout is applied to the
process.send_all method, which otherwise retries forever to send the
command.

Change-Id: I1f9e496d0efe6e7ff1e6b347253032c408d9e8d4
This commit is contained in:
Eduardo Olivares 2023-08-23 13:28:54 +02:00
parent 89f94d21cd
commit 5aafb1e068

View File

@ -158,21 +158,23 @@ def execute(command, environment=None, timeout=None, shell=None,
stdin=stdin,
login=login,
expect_exit_status=expect_exit_status,
decode_streams=decode_streams)
decode_streams=decode_streams,
timeout=timeout)
def execute_process(process: _process.ShellProcessFixture,
stdin=None,
expect_exit_status=0,
login=None,
decode_streams=True) \
decode_streams=True,
timeout=None) \
-> ShellExecuteResult:
error = None
status = None
try:
with process:
if stdin and isinstance(stdin, DATA_TYPES):
process.send_all(data=stdin)
process.send_all(data=stdin, timeout=timeout)
except _exception.ShellTimeoutExpired:
status = ShellExecuteStatus.TIMEDOUT
if expect_exit_status is not None: