Hi, With the below code (compiled by ghc) I get "a.out: thread blocked indefinitely".
Changing the second (Just hout) to Nothing makes it run as expected. If I dup fdout to get an fderr and then try to also convert that to a handle then I get "a.out: openFile: resource busy (file is locked)". Is there a way to write this with stdout and stderr going to the same handle? ------------------- module Main (main) where import System.Posix (openFd, defaultFileFlags, stdFileMode, OpenMode(ReadOnly, WriteOnly), fdToHandle) import System.Process (runProcess, waitForProcess) main :: IO () main = exec "echo" ["foo"] "in" "out" exec :: String -> [String] -> FilePath -> FilePath -> IO () exec c args inp out = do fdin <- openFd inp ReadOnly Nothing defaultFileFlags fdout <- openFd out WriteOnly (Just stdFileMode) defaultFileFlags hin <- fdToHandle fdin hout <- fdToHandle fdout ph <- runProcess c args Nothing Nothing (Just hin) (Just hout) (Just hout) waitForProcess ph >>= print ------------------- Thanks Ian _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell