Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore the stderr output when getting the parent tag #492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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