From b510dbd91eeb76b90a965201c605cbb145f47754 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Tue, 15 Nov 2022 16:43:27 +0100 Subject: [PATCH] sponsor-patch: Ignore exit code 1 of debdiff call sponsor-patch calls `debdiff` which exits with 1 if there are differences. So accept exit codes 0 and 1 as expected. Signed-off-by: Benjamin Drung --- ubuntutools/sponsor_patch/source_package.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ubuntutools/sponsor_patch/source_package.py b/ubuntutools/sponsor_patch/source_package.py index 99cc5fa..f21177c 100644 --- a/ubuntutools/sponsor_patch/source_package.py +++ b/ubuntutools/sponsor_patch/source_package.py @@ -327,12 +327,9 @@ class SourcePackage(object): if not Logger.isEnabledFor(logging.DEBUG): cmd.insert(1, "-q") Logger.debug(' '.join(cmd) + " > " + self._debdiff_filename) - debdiff = subprocess.check_output(cmd, encoding='utf-8') - - # write debdiff file - debdiff_file = open(self._debdiff_filename, "w") - debdiff_file.writelines(debdiff) - debdiff_file.close() + with open(self._debdiff_filename, "w") as debdiff_file: + debdiff = subprocess.run(cmd, check=False, stdout=debdiff_file) + assert debdiff.returncode in (0, 1) def is_fixed(self, lp_bug): """Make sure that the given Launchpad bug is closed.