[Haskell-cafe] No handles from createProcess

Henk-Jan van Tuyl hjgtuyl at chello.nl
Mon Dec 15 14:11:36 UTC 2014


L.S.,

I am experimenting with the createProcess function from the package  
"process"; this function does not return any handle, on both Ubuntu and  
Windows. I am doing something wrong, or is this a bug? (I am using GHC  
7.8.3 on both platforms.)

The program I am running:
---✂----------------------------------------------
import System.IO
import System.Process

f =
   do
     (  maybeStdinHandel
      , maybeStdoutHandel
      , maybeStderrHandel
      , processHandle
      ) <- createProcess (proc "cat" ["a.txt"])
     case maybeStdinHandel of
       Just stdinHandel ->
         do
           putStrLn "stdin"
       _ -> putStrLn "No stdin handle"
     case maybeStdoutHandel of
       Just stdoutHandel ->
         do
           putStrLn "stdout"
           putStrLn =<< hGetContents stdoutHandel
       _ -> putStrLn "No stdout handle"
     case maybeStderrHandel of
       Just stderrHandel ->
         do
           putStrLn "stderr"
           putStrLn =<< hGetContents stderrHandel
       _ -> putStrLn "No stderr handle"

main = f
---✂----------------------------------------------

The output:
---✂----------------------------------------------
$ ./ProcessTry
No stdin handle
No stdout handle
No stderr handle
asdf
---✂----------------------------------------------
(asdf is the contents of file a.txt)

Regards,
Henk-Jan van Tuyl


-- 
Folding at home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.
http://folding.stanford.edu/


http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--


More information about the Haskell-Cafe mailing list