Reading input using a system command in Haskell

hi I need to read the standard version command line after running the haskell command, I know that there are two modules for executing system commands: System.Cmd and System.Process

can someone show me a simple example how to run the System.Process functions?

here is an example of what I need to do (I know there is System.Directory for this, but I thought this was a good example):

  • execute a system command, for example ls -a
  • now I don’t want the user to see the output
  • the output should be available only in my program to check it

How can i do this?

+9
source share
1 answer
 import System.Process test = readProcess "ls" ["-a"] "" 

See the documentation for details.

+18
source

All Articles