File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -237,19 +237,16 @@ def is_exe(fpath):
237237 if is_exe (program ):
238238 return program
239239 else :
240+ exe_suffixes = ['' ]
241+ if WINDOWS and '.' not in fname :
242+ exe_suffixes = ['.exe' , '.cmd' , '.bat' ]
243+
240244 for path in os .environ ["PATH" ].split (os .pathsep ):
241245 path = path .strip ('"' )
242246 exe_file = os .path .join (path , program )
243- if is_exe (exe_file ):
244- return exe_file
245-
246- if WINDOWS and '.' not in fname :
247- if is_exe (exe_file + '.exe' ):
248- return exe_file + '.exe'
249- if is_exe (exe_file + '.cmd' ):
250- return exe_file + '.cmd'
251- if is_exe (exe_file + '.bat' ):
252- return exe_file + '.bat'
247+ for ext in exe_suffixes :
248+ if is_exe (exe_file + ext ):
249+ return exe_file + ext
253250
254251 return None
255252
You can’t perform that action at this time.
0 commit comments