
#8838: Allow running bash shell commands --------------------------+------------------------------------------------ Reporter: | Owner: jstolarek | Status: new Type: | Milestone: 7.10.1 feature request | Version: 7.8.1-rc2 Priority: normal | Operating System: Linux Component: | Type of failure: Incorrect result at runtime libraries/process | Test Case: Keywords: | Blocking: Architecture: | Unknown/Multiple | Difficulty: | Unknown | Blocked By: | Related Tickets: #8802 | --------------------------+------------------------------------------------ Current implementation of `process` library has limited usability. `CreateProcess` record stores `CmdSpec` field, which is either a `RawCommand` or `ShellCommand`. The problem is that: * `RawCommand` command quotes and escapes the command parameters * `ShellCommand` does no escaping but it runs command in `sh` shell Corollary: there is no way to run `bash` command with unescaped parameters. As a result there is no way to run this command (and many others): {{{ diff <(echo $ENV_FOO) <(echo $ENV_BAR) }}} Running it as a `RawCommand` (using `proc` function) fails because command line parameters are escaped and become incorrect. Running it as `ShellCommand` (using `shell` function) fails because this is not valid `sh` syntax. I propose to create function that allows user to run `bash` commands without escaping the parameters (or even better, run any shell the user wants). In other words this program: {{{ import System.Exit import System.Process main :: IO () main = do (_, _, _, pid) <- createProcess (SOME_NEW_FUNCTION "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 ":-(" }}} should produce: {{{ 1c1 < Foo ---
Bar }}}
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8838 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler