gitinspector now exits if it fails to change directory to the repo root.

This commit is contained in:
Adam Waldenberg 2013-07-10 16:58:06 +02:00
parent 84bb7bed2d
commit 8edd72a609

View file

@ -64,7 +64,11 @@ class Runner:
os.chdir(self.repo)
absolute_path = subprocess.Popen("git rev-parse --show-toplevel", shell=True, bufsize=1,
stdout=subprocess.PIPE).stdout
os.chdir(absolute_path.readlines()[0].decode("utf-8", "replace").strip())
absolute_path = absolute_path.readlines()
if len(absolute_path) == 0:
sys.exit(0)
os.chdir(absolute_path[0].decode("utf-8", "replace").strip())
if not format.select(self.opts.format):
raise format.InvalidFormatError(_("specified output format not supported."))