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

Commit 27c2b8f

Browse files
On Windows executables called with subprocess.POpen are not searched in %PATH%. This has to be done separately.
1 parent d96a193 commit 27c2b8f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

searchengines/base.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import re
33
import shlex
44
import sys
5+
import os
56

67
class Base:
78
"""
@@ -27,7 +28,8 @@ def __init__(self, settings):
2728
if sys.version < '3':
2829
setting_value = setting_value.encode()
2930
setattr(self, setting_name, setting_value)
30-
pass
31+
if os.name=='nt':
32+
self._resolve_windows_path_to_executable()
3133

3234
def run(self, query, folders):
3335
"""
@@ -80,3 +82,13 @@ def _full_settings_name(self, name):
8082

8183
def _filter_lines_without_matches(self, line_parts):
8284
return filter(lambda line: len(line) > 2, line_parts)
85+
86+
def _resolve_windows_path_to_executable(self):
87+
try:
88+
self.path_to_executable = self._sanitize_output(subprocess.check_output("where %s" % self.path_to_executable))
89+
except subprocess.CalledProcessError:
90+
# do nothing, executable not found
91+
pass
92+
except sys.FileNotFoundError:
93+
# do nothing, executable not found
94+
pass

0 commit comments

Comments
 (0)