[GRASS-dev] [GRASS GIS] #2398: grass.exec_command should add .exe where needed

GRASS GIS trac at osgeo.org
Wed Aug 20 13:54:31 PDT 2014


#2398: grass.exec_command should add .exe where needed
---------------------------+------------------------------------------------
 Reporter:  michikommader  |       Owner:  grass-dev@…              
     Type:  defect         |      Status:  new                      
 Priority:  normal         |   Milestone:  7.0.0                    
Component:  Python         |     Version:  svn-releasebranch70      
 Keywords:                 |    Platform:  MSWindows 7              
      Cpu:  x86-32         |  
---------------------------+------------------------------------------------

Comment(by glynn):

 Replying to [ticket:2398 michikommader]:

 > It looks like you have to add a ".exe" in some cases under Windows.

 It isn't quite that simple, as it's perfectly valid to "exec" a script.

 Unlike the other *_command() functions, exec_command() isn't based upon
 Popen() objects, but upon os.execvpe().

 os.execvpe() will attempt to locate the executable in the directories
 specified by PATH, but it won't attempt to determine the suffix according
 to PATHEXT. The only way in which we could determine the suffix is to
 enumerate over both PATH and PATHEXT until a match is found.

 Alternatively, we could just "fake it" on Windows by calling e.g.
 run_command() then exit()ing as soon as it returns. I'm fairly sure that's
 what the Windows' execvpe() is doing (on Unix, the exec* functions replace
 the program for the current process).

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2398#comment:2>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list