[Haskell-cafe] Ctrl-C handling in Haskell with curl on Linux

2009-09-24 Thread Vasyl Pasternak
Hi, Yesterday I tried to implement simple tool to download pages, and wanted catch Ctrl-C (and other 'killing' messages) from haskell to handle state saving. Without curl (when I perform some long operation) haskell throws UserInterrupt exception immediately, but if I put long operation, which dow

Re: [Haskell-cafe] Ctrl-C handling in Haskell with curl on Linux

2009-09-24 Thread Bulat Ziganshin
Hello Vasyl, Thursday, September 24, 2009, 1:30:46 PM, you wrote: > I couldn't find any solutions to this problem, I am afraid that > this problem could occur in other non-native haskell modules (bindings to C > libraries) look at GHC.ConsoleHandler module -- Best regards, Bulat

Re: [Haskell-cafe] Ctrl-C handling in Haskell with curl on Linux

2009-09-24 Thread Brandon S. Allbery KF8NH
On Sep 24, 2009, at 05:30 , Vasyl Pasternak wrote: Yesterday I tried to implement simple tool to download pages, and wanted catch Ctrl-C (and other 'killing' messages) from haskell to handle state saving. Without curl (when I perform some long operation) haskell throws UserInterrupt exceptio

Re: [Haskell-cafe] Ctrl-C handling in Haskell with curl on Linux

2009-09-24 Thread Brandon S. Allbery KF8NH
On Sep 24, 2009, at 06:20 , Brandon S. Allbery KF8NH wrote: On Sep 24, 2009, at 05:30 , Vasyl Pasternak wrote: Yesterday I tried to implement simple tool to download pages, and wanted catch Ctrl-C (and other 'killing' messages) from haskell to handle state saving. Without curl (when I perform

Re: [Haskell-cafe] Ctrl-C handling in Haskell with curl on Linux

2009-09-24 Thread Vasyl Pasternak
Thank you, You give me and idea, and I fixed this annoying bug - we should only wrap all curl code into withCurlDo function, so the longTask function should be following: longTask = do putStrLn "Long task started (curl)" withCurlDo $ do curl <- initialize setopts cur