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

Commit 8e706fd

Browse files
committed
Patch to avoid creating console window on Windows platform
1 parent bba3abb commit 8e706fd

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

searchengines/base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ def run(self, query, folders):
4141
print("Running: %s" % " ".join(arguments))
4242

4343
try:
44+
startupinfo = subprocess.STARTUPINFO()
45+
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
4446
pipe = subprocess.Popen(arguments,
4547
stdout=subprocess.PIPE,
4648
stderr=subprocess.PIPE,
47-
cwd=folders[0]
49+
cwd=folders[0],
50+
startupinfo=startupinfo
4851
)
4952
except OSError: # Not FileNotFoundError for compatibility with Sublime Text 2
5053
raise RuntimeError("Could not find executable %s" % self.path_to_executable)
@@ -86,7 +89,9 @@ def _filter_lines_without_matches(self, line_parts):
8689

8790
def _resolve_windows_path_to_executable(self):
8891
try:
89-
self.path_to_executable = self._sanitize_output(subprocess.check_output("where %s" % self.path_to_executable))
92+
startupinfo = subprocess.STARTUPINFO()
93+
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
94+
self.path_to_executable = self._sanitize_output(subprocess.check_output("where %s" % self.path_to_executable, startupinfo=startupinfo))
9095
except subprocess.CalledProcessError:
9196
# do nothing, executable not found
9297
pass

0 commit comments

Comments
 (0)