diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-07-28 11:16:08 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-07-29 08:34:35 +0100 |
commit | 269479f6f4fc35545c6ae8322bcda90e3cf151ca (patch) | |
tree | f6e9d01c09f13702e805ec79e926c92060c866a4 /meta/lib/oeqa/core/target | |
parent | 10ab0949a13354bd502947fe2df97cf0eedcdfca (diff) | |
download | poky-269479f6f4fc35545c6ae8322bcda90e3cf151ca.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: 3924e94214b5135369be2551d54fb92097d35e95)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core/target')
-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 243e45dd99..72ed1adbf8 100644 --- a/meta/lib/oeqa/core/target/ssh.py +++ b/meta/lib/oeqa/core/target/ssh.py | |||
@@ -265,6 +265,7 @@ def SSHCall(command, logger, timeout=None, **opts): | |||
265 | time.sleep(5) | 265 | time.sleep(5) |
266 | try: | 266 | try: |
267 | process.kill() | 267 | process.kill() |
268 | process.wait() | ||
268 | except OSError: | 269 | except OSError: |
269 | logger.debug('OSError when killing process') | 270 | logger.debug('OSError when killing process') |
270 | pass | 271 | pass |
@@ -287,6 +288,7 @@ def SSHCall(command, logger, timeout=None, **opts): | |||
287 | except TimeoutExpired: | 288 | except TimeoutExpired: |
288 | try: | 289 | try: |
289 | process.kill() | 290 | process.kill() |
291 | process.wait() | ||
290 | except OSError: | 292 | except OSError: |
291 | logger.debug('OSError') | 293 | logger.debug('OSError') |
292 | pass | 294 | pass |
@@ -316,6 +318,7 @@ def SSHCall(command, logger, timeout=None, **opts): | |||
316 | # whilst running and ensure we don't leave a process behind. | 318 | # whilst running and ensure we don't leave a process behind. |
317 | if process.poll() is None: | 319 | if process.poll() is None: |
318 | process.kill() | 320 | process.kill() |
321 | process.wait() | ||
319 | logger.debug('Something went wrong, killing SSH process') | 322 | logger.debug('Something went wrong, killing SSH process') |
320 | raise | 323 | raise |
321 | 324 | ||