Skip to content

Commit 66d4be8

Browse files
authored
Ensure that git_path is a valid file (#11138)
* Ensure that git_path is a valid file * Update github_updater.py
1 parent d44ae91 commit 66d4be8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: medusa/updater/github_updater.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import unicode_literals
44

55
import logging
6+
import os
67
import platform
78
import re
89
import subprocess
@@ -72,11 +73,7 @@ def commits_ahead(self):
7273

7374
def _find_working_git(self):
7475
test_cmd = 'version'
75-
76-
if app.GIT_PATH:
77-
main_git = '"' + app.GIT_PATH + '"'
78-
else:
79-
main_git = 'git'
76+
main_git = app.GIT_PATH or 'git'
8077

8178
log.debug(u'Checking if we can use git commands: {0} {1}', main_git, test_cmd)
8279
_, _, exit_status = self._run_git(main_git, test_cmd)
@@ -126,6 +123,11 @@ def _run_git(self, git_path, args):
126123
exit_status = 1
127124
return output, err, exit_status
128125

126+
if git_path != 'git' and not os.path.isfile(git_path):
127+
log.warning(u"Invalid git specified, can't use git commands")
128+
exit_status = 1
129+
return output, err, exit_status
130+
129131
# If we have a valid git remove the git warning
130132
# String will be updated as soon we check github
131133
app.NEWEST_VERSION_STRING = None

0 commit comments

Comments
 (0)