summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
authorYoann Congal <yoann.congal@smile.fr>2025-08-06 17:55:49 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-08-07 12:11:16 +0100
commit938abd7c30668480c0394b7ea6605e187ab78ecb (patch)
tree4b920b5bea960a38591f30e85f3418f0da614189 /scripts/runqemu
parentb4eacbf7c17f1691db6c44b9af4620a085d5394b (diff)
downloadpoky-938abd7c30668480c0394b7ea6605e187ab78ecb.tar.gz
runqemu: refactor a duplicated cleanup statement
Refactor using a "finally:" instead of a duplicated statement inside and outside of the try/except block. (From OE-Core rev: c92399c355d1333eff37ea799832a8890acd0d74) Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu7
1 files changed, 3 insertions, 4 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 4fb85177e3..3a339acc2a 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -450,11 +450,10 @@ class BaseConfig(object):
450 try: 450 try:
451 subprocess.check_call(['zstd', '-d', image_path, '-o', uncompressed_path]) 451 subprocess.check_call(['zstd', '-d', image_path, '-o', uncompressed_path])
452 except subprocess.CalledProcessError as e: 452 except subprocess.CalledProcessError as e:
453 self.cleanup_files.append(uncompressed_path)
454 raise RunQemuError(f"Failed to decompress {self.rootfs}: {e}") 453 raise RunQemuError(f"Failed to decompress {self.rootfs}: {e}")
455 454 finally:
456 # Mark for deletion at the end 455 # Mark temporary file for deletion
457 self.cleanup_files.append(uncompressed_path) 456 self.cleanup_files.append(uncompressed_path)
458 457
459 # Use the decompressed image as the rootfs 458 # Use the decompressed image as the rootfs
460 self.rootfs = uncompressed_path 459 self.rootfs = uncompressed_path