diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-07-28 11:16:08 +0100 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2023-08-15 06:18:49 -1000 |
commit | 998d1cf1d9505344b630f9d80918a0e77d5585e1 (patch) | |
tree | 3a3ab6f0efedd652a1cd45fb954b5432e4d95b43 | |
parent | b34941d07221b82c9067a104169d799f8ff9b95b (diff) | |
download | poky-998d1cf1d9505344b630f9d80918a0e77d5585e1.tar.gz |
target/ssh: Ensure exit code set for commands
As spotted by Joshua Watt, the returncode isn't set until .poll() or .wait()
is called so we need to call this after the .kill() call.
This fixes return code reporting so that timeouts for example now return an
exit code when they didn't before.
(From OE-Core rev: 6bd6b7110ea2029fc736a40760536adfaf28eec0)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 3924e94214b5135369be2551d54fb92097d35e95)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | meta/lib/oeqa/core/target/ssh.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py index 764ec339a0..1cd496c2f4 100644 --- a/meta/lib/oeqa/core/target/ssh.py +++ b/meta/lib/oeqa/core/target/ssh.py | |||
@@ -262,6 +262,7 @@ def SSHCall(command, logger, timeout=None, **opts): | |||
262 | time.sleep(5) | 262 | time.sleep(5) |
263 | try: | 263 | try: |
264 | process.kill() | 264 | process.kill() |
265 | process.wait() | ||
265 | except OSError: | 266 | except OSError: |
266 | logger.debug('OSError when killing process') | 267 | logger.debug('OSError when killing process') |
267 | pass | 268 | pass |
@@ -284,6 +285,7 @@ def SSHCall(command, logger, timeout=None, **opts): | |||
284 | except TimeoutExpired: | 285 | except TimeoutExpired: |
285 | try: | 286 | try: |
286 | process.kill() | 287 | process.kill() |
288 | process.wait() | ||
287 | except OSError: | 289 | except OSError: |
288 | logger.debug('OSError') | 290 | logger.debug('OSError') |
289 | pass | 291 | pass |
@@ -313,6 +315,7 @@ def SSHCall(command, logger, timeout=None, **opts): | |||
313 | # whilst running and ensure we don't leave a process behind. | 315 | # whilst running and ensure we don't leave a process behind. |
314 | if process.poll() is None: | 316 | if process.poll() is None: |
315 | process.kill() | 317 | process.kill() |
318 | process.wait() | ||
316 | logger.debug('Something went wrong, killing SSH process') | 319 | logger.debug('Something went wrong, killing SSH process') |
317 | raise | 320 | raise |
318 | 321 | ||