summaryrefslogtreecommitdiffstats
path: root/repo
diff options
context:
space:
mode:
Diffstat (limited to 'repo')
-rwxr-xr-xrepo13
1 files changed, 5 insertions, 8 deletions
diff --git a/repo b/repo
index 21085688..782afb6e 100755
--- a/repo
+++ b/repo
@@ -482,11 +482,6 @@ def InitParser(parser):
482 return parser 482 return parser
483 483
484 484
485# This is a poor replacement for subprocess.run until we require Python 3.6+.
486class RunError(Exception):
487 """Error when running a command failed."""
488
489
490def run_command(cmd, **kwargs): 485def run_command(cmd, **kwargs):
491 """Run |cmd| and return its output.""" 486 """Run |cmd| and return its output."""
492 check = kwargs.pop("check", False) 487 check = kwargs.pop("check", False)
@@ -544,7 +539,8 @@ def run_command(cmd, **kwargs):
544 539
545 _print_output("stdout", ret.stdout) 540 _print_output("stdout", ret.stdout)
546 _print_output("stderr", ret.stderr) 541 _print_output("stderr", ret.stderr)
547 raise RunError(ret) 542 # This will raise subprocess.CalledProcessError for us.
543 ret.check_returncode()
548 544
549 return ret 545 return ret
550 546
@@ -668,7 +664,7 @@ def run_git(*args, **kwargs):
668 file=sys.stderr, 664 file=sys.stderr,
669 ) 665 )
670 sys.exit(1) 666 sys.exit(1)
671 except RunError: 667 except subprocess.CalledProcessError:
672 raise CloneFailure() 668 raise CloneFailure()
673 669
674 670
@@ -850,7 +846,8 @@ def _GetRepoConfig(name):
850 f"repo: error: git {' '.join(cmd)} failed:\n{ret.stderr}", 846 f"repo: error: git {' '.join(cmd)} failed:\n{ret.stderr}",
851 file=sys.stderr, 847 file=sys.stderr,
852 ) 848 )
853 raise RunError() 849 # This will raise subprocess.CalledProcessError for us.
850 ret.check_returncode()
854 851
855 852
856def _InitHttp(): 853def _InitHttp():