#3231: Permission denied error with runProcess/openFile
---------------------------------+------------------------------------------
    Reporter:  NeilMitchell      |        Owner:  igloo   
        Type:  bug               |       Status:  reopened
    Priority:  normal            |    Milestone:  6.10.4  
   Component:  Runtime System    |      Version:  6.10.4  
    Severity:  normal            |   Resolution:          
    Keywords:                    |   Difficulty:  Unknown 
    Testcase:                    |           Os:  Windows 
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Changes (by yugr):

  * status:  closed => reopened
  * type:  merge => bug
  * version:  6.10.2 => 6.10.4
  * resolution:  fixed =>
  * severity:  major => normal

Comment:

 I think the problem remains. This

 module Main where

 import System
 import System.IO
 import System.Process
 import System.Directory

 import Control.Monad

 import Data.List

 tempFile = "mytempfile.txt"

 run :: FilePath -> IO String
 run exe = do
   h <- openFile tempFile WriteMode

   pid <- runProcess exe [] Nothing Nothing Nothing (Just h) (Just h)
   exitCode <- waitForProcess pid

   hClose h

   if exitCode /= ExitSuccess
     then error $ exe ++ " failed"
     else do
       readFile tempFile

 main = replicateM_ 10 (run "dir")

 gives me

 *** Exception: mytempfile.txt: openFile: permission denied (Permission
 denied)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3231#comment:25>
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