Skip to content

Commit 3910104

Browse files
authored
Merge pull request #72 from Microsoft/users/tedchamb/version
handle os error
2 parents 88cb16a + d6e5de1 commit 3910104

File tree

1 file changed

+3
-3
lines changed
  • src/common_modules/vsts-cli-common/vsts/cli/common

1 file changed

+3
-3
lines changed

src/common_modules/vsts-cli-common/vsts/cli/common/git.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _get_git_config_scope_arg(local):
4040
def get_current_branch_name():
4141
try:
4242
output = subprocess.check_output([_GIT_EXE, 'symbolic-ref', '--short', '-q', 'HEAD'])
43-
except subprocess.CalledProcessError as ex:
43+
except Exception as ex:
4444
logging.info('GitDetect: Could not detect current branch based on current working directory.')
4545
logging.exception(ex)
4646
return None
@@ -71,7 +71,7 @@ def get_git_credentials(team_instance):
7171
standard_in = bytes('protocol={protocol}\nhost={host}'.format(protocol=protocol, host=host), 'utf-8')
7272
try:
7373
output = subprocess.check_output([_GIT_EXE, 'credential-manager', 'get'], input=standard_in)
74-
except subprocess.CalledProcessError as ex:
74+
except Exception as ex:
7575
logging.info('GitDetect: Could not detect git credentials for current working directory.')
7676
logging.exception(ex)
7777
return None
@@ -98,7 +98,7 @@ def get_git_remotes():
9898
# origin https://mseng.visualstudio.com/defaultcollection/VSOnline/_git/VSO (fetch)
9999
# origin https://mseng.visualstudio.com/defaultcollection/VSOnline/_git/VSO (push)
100100
output = subprocess.check_output([_GIT_EXE, 'remote', '-v'], stderr=subprocess.STDOUT)
101-
except subprocess.CalledProcessError as ex:
101+
except Exception as ex:
102102
logging.info('GitDetect: Could not detect current remotes based on current working directory.')
103103
logging.exception(ex)
104104
return None

0 commit comments

Comments
 (0)