[GHC] #8838: Allow running bash shell commands

GHC ghc-devs at haskell.org
Mon Mar 3 08:30:33 UTC 2014


#8838: Allow running bash shell commands
------------------------------------------------+--------------------------
        Reporter:  jstolarek                    |            Owner:
            Type:  feature request              |           Status:  new
        Priority:  normal                       |        Milestone:  7.10.1
       Component:  libraries/process            |          Version:
      Resolution:                               |  7.8.1-rc2
Operating System:  Linux                        |         Keywords:
 Type of failure:  Incorrect result at runtime  |     Architecture:
       Test Case:                               |  Unknown/Multiple
        Blocking:                               |       Difficulty:
                                                |  Unknown
                                                |       Blocked By:
                                                |  Related Tickets:  #8802
------------------------------------------------+--------------------------

Comment (by nomeata):

 Use
 {{{
 import System.Exit
 import System.Process

 main :: IO ()
 main = do
   (_, _, _, pid) <- createProcess (proc "bash" ["-c", "diff <(echo $FOO)
 <(echo $BAR)"] )
                                         { env = Just
 [("FOO","Foo"),("BAR","Bar")] }
   ecode <- waitForProcess pid
   case ecode of
     ExitSuccess   -> putStrLn "All’s right with the world!"
     ExitFailure _ -> putStrLn ":-("
 }}}

 I don’t think `System.Process` needs any special support for `bash`
 features, just like there is no special way to invoke `perl -e` or `sed`
 or `ghc -e`.

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


More information about the ghc-tickets mailing list