Flutter Engine
The Flutter Engine
Functions
get_dot_git_folder Namespace Reference

Functions

def main ()
 

Function Documentation

◆ main()

def get_dot_git_folder.main ( )

Definition at line 14 of file get_dot_git_folder.py.

14def main():
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
20 windows = utils.GuessOS() == 'win32'
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
41 print(outs.strip())
42 except:
43 # Fall back to fall-back path.
44 print(sys.argv[2])
45
46
def print(*args, **kwargs)
Definition: run_tests.py:49
def GuessOS()
Definition: utils.py:21