Skip to content

Commit

Permalink
Ignore the stderr output when getting the parent tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimeMF committed May 30, 2024
1 parent 9df35c1 commit 8722047
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions TarSCM/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ 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
Expand All @@ -34,11 +35,12 @@ def run_cmd(self, cmd, cwd, interactive=False, raisesysexit=False):
"""
logging.debug("COMMAND: %s" % cmd)

proc = subprocess.Popen(cmd,
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
cwd=cwd)
proc = subprocess.Popen(
cmd,
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT if includeStderr else subprocess.DEVNULL,
cwd=cwd)
output = ''
if interactive:
stdout_lines = []
Expand Down
3 changes: 2 additions & 1 deletion TarSCM/scm/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ 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
Expand Down

0 comments on commit 8722047

Please sign in to comment.