Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit ffc751f

Browse files
Fix git grep - split executable so that it works with passing array of arguments into subprocess.POpen; make sure to set working directory so git isn’t lost.
1 parent 3aa8235 commit ffc751f

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

SearchInProject.sublime-settings

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"search_in_project_TheSilverSearcher_mandatory_options": "--column --search-files --nogroup --nocolor",
2727

2828
/* GitGrep configuration */
29-
"search_in_project_GitGrep_path_to_executable": "git grep",
30-
"search_in_project_GitGrep_mandatory_options": "--line",
29+
"search_in_project_GitGrep_path_to_executable": "git",
30+
"search_in_project_GitGrep_mandatory_options": "grep --line",
3131

3232
/* FindStr configuration */
3333
"search_in_project_FindStr_path_to_executable": "findstr",

searchengines/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def run(self, query, folders):
4343
try:
4444
pipe = subprocess.Popen(arguments,
4545
stdout=subprocess.PIPE,
46-
stderr=subprocess.PIPE
46+
stderr=subprocess.PIPE,
47+
cwd=folders[0]
4748
)
4849
except OSError as e: # Not FileNotFoundError for compatibility with Sublime Text 2
4950
raise RuntimeError("Could not find executable %s" % self.path_to_executable)

0 commit comments

Comments
 (0)