Skip to content
This repository was archived by the owner on Mar 2, 2025. It is now read-only.

Commit 66e2429

Browse files
committed
Remove stderr if we don't read it
1 parent c7db69d commit 66e2429

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

dev_tools/git_helper.py

+16-5
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ def check_exists_tag_local(tag_value=None):
311311
)
312312

313313
cmd = "git tag"
314-
return_code, stdout, stderr = ciscoconfparse.ccp_util.run_this_posix_command(cmd)
314+
return_code, stdout, _ = ciscoconfparse.ccp_util.run_this_posix_command(cmd)
315+
if return_code > 0:
316+
raise OSError()
315317

316318
for line in stdout.splitlines():
317319
if tag_value.strip() == line.strip():
@@ -326,7 +328,9 @@ def git_root_directory():
326328
return a string with the path name of the git root directory.
327329
"""
328330
cmd = "git rev-parse --show-toplevel"
329-
return_code, stdout, stderr = ciscoconfparse.ccp_util.run_this_posix_command(cmd)
331+
return_code, stdout, _ = ciscoconfparse.ccp_util.run_this_posix_command(cmd)
332+
if return_code > 0:
333+
raise OSError()
330334
retval = None
331335
for line in stdout.splitlines():
332336
if line.strip() != "":
@@ -545,14 +549,21 @@ def main(args):
545549

546550
## FIXME git merge command below does NOT merge anything...
547551
cmd = f"git merge {original_branch_name} -m '{args.message}'"
548-
return_code, stdout, stderr = ciscoconfparse.ccp_util.run_this_posix_command(cmd)
552+
return_code, _, _ = ciscoconfparse.ccp_util.run_this_posix_command(cmd)
553+
if return_code > 0:
554+
raise OSError()
555+
549556

550557
cmd = "git push origin main"
551-
return_code, stdout, stderr = ciscoconfparse.ccp_util.run_this_posix_command(cmd)
558+
return_code, _, _ = ciscoconfparse.ccp_util.run_this_posix_command(cmd)
559+
if return_code > 0:
560+
raise OSError()
552561

553562
if args.tag is True:
554563
cmd = "git push origin main --tags"
555-
return_code, stdout, stderr = ciscoconfparse.ccp_util.run_this_posix_command(cmd)
564+
return_code, _, _ = ciscoconfparse.ccp_util.run_this_posix_command(cmd)
565+
if return_code > 0:
566+
raise OSError()
556567

557568
if original_branch_name != "main":
558569
args.branch = original_branch_name

0 commit comments

Comments
 (0)