#6094: runInteractiveProcess not using new PATH
-------------------------------+--------------------------------------------
  Reporter:  GregWeber         |          Owner:  GregWeber       
      Type:  task              |         Status:  patch           
  Priority:  normal            |      Milestone:                  
 Component:  Compiler          |        Version:  7.4.1           
Resolution:                    |       Keywords:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown      |     Difficulty:  Unknown         
  Testcase:                    |      Blockedby:                  
  Blocking:                    |        Related:                  
-------------------------------+--------------------------------------------

Comment(by GregWeber):

 {{{
 diff --git a/System/Directory.hs b/System/Directory.hs
 index 1819508..a1c7349 100644
 --- a/System/Directory.hs
 +++ b/System/Directory.hs
 @@ -47,10 +47,11 @@ module System.Directory
      , copyFile                  -- :: FilePath -> FilePath -> IO ()

      , canonicalizePath
      , makeRelativeToCurrentDirectory
      , findExecutable
 +    , findExecutableFromPath

      -- * Existence tests
      , doesFileExist             -- :: FilePath -> IO Bool
      , doesDirectoryExist        -- :: FilePath -> IO Bool

 @@ -776,22 +777,28 @@ findExecutable binary =
  #if defined(mingw32_HOST_OS)
    Win32.searchPath Nothing binary ('.':exeExtension)
  #else
   do
    path <- getEnv "PATH"
 -  search (splitSearchPath path)
 +  findExecutableFromPath path binary
 +#endif
 +
 +-- | Search through the given PATH for the given executable
 +-- Used by 'findExecutable' on non-windows platforms.
 +findExecutableFromPath :: String -> String -> IO (Maybe FilePath)
 +findExecutableFromPath path binary =
 +    search (splitSearchPath path)
    where
      fileName = binary <.> exeExtension

      search :: [FilePath] -> IO (Maybe FilePath)
      search [] = return Nothing
      search (d:ds) = do
          let path = d </> fileName
          b <- doesFileExist path
          if b then return (Just path)
               else search ds
 -#endif


 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6094#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to