Philip Müller | 15 May 21:16
Favicon

getting output from shell commands

Hi,

I would like to be able to run a shell command like curl and process the 
output in my Haskell program, but I couldn't find anything helpful about it.

Something like

main = do
         args <- getArgs
         inp <- exec "curl" args
         putStrLn (processInput inp)

would be very helpful.

Regards
Philip
Jeff Polakow | 15 May 21:23

Re: getting output from shell commands


Hello,
 
> I would like to be able to run a shell command like curl and process the
> output in my Haskell program, but I couldn't find anything helpful about it.
>
Try looking in System.Process. runInteractiveProcess should work for you.

-Jeff

---

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Olivier Boudry | 15 May 21:37
Picon

Re: getting output from shell commands

Hi Philip,

I just asked a question to the list about using runInteractiveCommand. You may find the code useful but will need to either remove the forkIO instruction or synchronize the two threads using a MVar to avoid the concurrency problem I had.

You'll find the thread here:

    http://www.haskell.org/pipermail/haskell-cafe/2008-May/042975.html

Regards,

Olivier.

On Thu, May 15, 2008 at 3:18 PM, Philip Müller <mail <at> philip.in-aachen.net> wrote:
Hi,

I would like to be able to run a shell command like curl and process the output in my Haskell program, but I couldn't find anything helpful about it.

Something like

main = do
       args <- getArgs
       inp <- exec "curl" args
       putStrLn (processInput inp)

would be very helpful.

Regards
Philip
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane