summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-07-28 11:16:08 +0100
committerSteve Sakoman <steve@sakoman.com>2023-08-26 04:24:02 -1000
commit1efc676afc2e3373e3bbf05a736b67056adc4ad4 (patch)
tree65f044950bbc7b04a88550d1dc074107232fb369 /meta/lib
parent442b9fd2449d7bd245cff1acdb920e33676cd47e (diff)
downloadpoky-1efc676afc2e3373e3bbf05a736b67056adc4ad4.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: c70b05ea667e7bd280470b0b6ca10efb0f648e0f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 3924e94214b5135369be2551d54fb92097d35e95) Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/core/target/ssh.py3
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 7c206ff105..69fdc146f0 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