Quoth David Roundy <[EMAIL PROTECTED]>:
...
| My point was that which of these is correct entirely depends on what
| your input is.  It's often a huge (and security-bug-prone) chore to
| escape all those shell characters, and so in many cases it's much
| nicer to execute an external program direcly without invoking a
| shell.

That's true, and in the other cases - when you want the shell to
process the command line - you should be able to invoke it.

I'm not looking at the source code (nor even running my example, since
I don't have ghc handy), but the basic difference is not "runCommand
parses the arguments", but "runCommand [only] invokes the shell".
If you want runProcess to invoke the shell:

   runProcess "/bin/sh" ["-c", commandLine] ...

(... ought to be ["sh", "-c" commandLine], but the way I remember it
ghc gratuitously prevents you from specifying argv 0.)

        Donn Cave, [EMAIL PROTECTED]

[I just sifted this thread out of ca. 300 spams and stuff, so please
pardon me if this has already been mentioned in another followup.]
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to