mirror of
https://git.yoctoproject.org/poky
synced 2026-04-26 18:32:13 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
b4eacbf7c1
commit
938abd7c30
@@ -450,11 +450,10 @@ class BaseConfig(object):
|
||||
try:
|
||||
subprocess.check_call(['zstd', '-d', image_path, '-o', uncompressed_path])
|
||||
except subprocess.CalledProcessError as e:
|
||||
self.cleanup_files.append(uncompressed_path)
|
||||
raise RunQemuError(f"Failed to decompress {self.rootfs}: {e}")
|
||||
|
||||
# Mark for deletion at the end
|
||||
self.cleanup_files.append(uncompressed_path)
|
||||
finally:
|
||||
# Mark temporary file for deletion
|
||||
self.cleanup_files.append(uncompressed_path)
|
||||
|
||||
# Use the decompressed image as the rootfs
|
||||
self.rootfs = uncompressed_path
|
||||
|
||||
Reference in New Issue
Block a user