From 6130a9c51f57c8229a44638c44eb234bc9f05d61 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 5 Nov 2021 16:52:18 +0100 Subject: [PATCH] [unpackfs] Re-jig process-return-value in Python - make the installation work, - special case because rsync can return error 23 (which throws, from inside the Python API) which still means "it was ok". --- src/modules/unpackfs/main.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py index 76692f2b3..9f1bd822c 100644 --- a/src/modules/unpackfs/main.py +++ b/src/modules/unpackfs/main.py @@ -227,7 +227,11 @@ def file_copy(source, entry, progress_cb): counter.last_total_reported = num_files_total_local progress_cb(num_files_copied, num_files_total_local) - libcalamares.utils.host_env_process_output(args, output_cb) + try: + returncode = libcalamares.utils.host_env_process_output(args, output_cb) + except subprocess.CalledProcessError as e: + returncode = e.returncode + progress_cb(counter.last_num_files_copied, counter.last_total_reported) # Push towards 100% # Mark this entry as really done @@ -245,9 +249,9 @@ def file_copy(source, entry, progress_cb): # have to do. See also: # https://bugzilla.redhat.com/show_bug.cgi?id=868755#c50 # for the same issue in Anaconda, which uses a similar workaround. - if process.returncode != 0 and process.returncode != 23: - libcalamares.utils.warning("rsync failed with error code {}.".format(process.returncode)) - return _("rsync failed with error code {}.").format(process.returncode) + if returncode != 0 and returncode != 23: + libcalamares.utils.warning("rsync failed with error code {}.".format(returncode)) + return _("rsync failed with error code {}.").format(returncode) return None