15 try:
16 if len(sys.argv) != 3:
17 raise Exception('Expects exactly 2 arguments.')
18 args = ['git', 'rev-parse', '--resolve-git-dir', sys.argv[1]]
19
21 if windows:
22 process = subprocess.Popen(args,
23 stdout=subprocess.PIPE,
24 stderr=subprocess.PIPE,
25 stdin=subprocess.PIPE,
26 shell=True,
27 universal_newlines=True)
28 else:
29 process = subprocess.Popen(args,
30 stdout=subprocess.PIPE,
31 stderr=subprocess.PIPE,
32 stdin=subprocess.PIPE,
33 shell=False,
34 universal_newlines=True)
35
36 outs, _ = process.communicate()
37
38 if process.returncode != 0:
39 raise Exception('Got non-0 exit code from git.')
40
42 except:
43
45
46
def print(*args, **kwargs)