From 8977a284dba3bb25a93cc3ca6608333035771249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Thu, 30 May 2024 22:50:05 +0200 Subject: [PATCH] Ignore the stderr output when getting the parent tag --- TarSCM/helpers.py | 4 ++-- TarSCM/scm/git.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TarSCM/helpers.py b/TarSCM/helpers.py index 0254a97e..c75d0a19 100644 --- a/TarSCM/helpers.py +++ b/TarSCM/helpers.py @@ -25,7 +25,7 @@ def file_write_legacy(fname, string, *args): class Helpers(): - def run_cmd(self, cmd, cwd, interactive=False, raisesysexit=False): + def run_cmd(self, cmd, cwd, interactive=False, raisesysexit=False, includeStderr=True): """ Execute the command cmd in the working directory cwd and check return value. If the command returns non-zero and raisesysexit is True raise a @@ -37,7 +37,7 @@ def run_cmd(self, cmd, cwd, interactive=False, raisesysexit=False): proc = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, + stderr=subprocess.STDOUT if includeStderr else subprocess.DEVNULL, cwd=cwd) output = '' if interactive: diff --git a/TarSCM/scm/git.py b/TarSCM/scm/git.py index 87bdfdb6..7cde3391 100644 --- a/TarSCM/scm/git.py +++ b/TarSCM/scm/git.py @@ -307,7 +307,7 @@ def _detect_parent_tag(self, args=None): cmd.append("--match=%s" % args['match_tag']) except KeyError: pass - rcode, output = self.helpers.run_cmd(cmd, self.clone_dir) + rcode, output = self.helpers.run_cmd(cmd, self.clone_dir, includeStderr=False) if rcode == 0: # strip to remove newlines